diff --git a/.chronus/changes/fix_test_ordering-2024-3-1-10-32-24.md b/.chronus/changes/fix_test_ordering-2024-3-1-10-32-24.md new file mode 100644 index 0000000000..3ed144994c --- /dev/null +++ b/.chronus/changes/fix_test_ordering-2024-3-1-10-32-24.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-client-generator-core" +--- + +order tests into a spread section \ No newline at end of file diff --git a/packages/typespec-client-generator-core/src/http.ts b/packages/typespec-client-generator-core/src/http.ts index 1d0a786b26..0a784c9eec 100644 --- a/packages/typespec-client-generator-core/src/http.ts +++ b/packages/typespec-client-generator-core/src/http.ts @@ -440,7 +440,7 @@ export function getCorrespondingMethodParams( ) ); } - if (correspondingProperties.length === serviceParamType.properties.length) + if (correspondingProperties.length === serviceParamPropertyNames.length) return correspondingProperties; throw new Error( `Can't find corresponding parameter for ${serviceParam.name} out of ${methodParameters.map((m) => m.name).join(", ")}` diff --git a/packages/typespec-client-generator-core/test/package.test.ts b/packages/typespec-client-generator-core/test/package.test.ts index 2e9483727c..3e89616a65 100644 --- a/packages/typespec-client-generator-core/test/package.test.ts +++ b/packages/typespec-client-generator-core/test/package.test.ts @@ -1342,170 +1342,6 @@ describe("typespec-client-generator-core: package", () => { strictEqual(correspondingContentTypeMethodParams[0], methodContentTypeParam); }); - it("body spread", async () => { - await runner.compile(`@server("http://localhost:3000", "endpoint") - @service({}) - namespace My.Service; - - model Input { - key: string; - } - - op myOp(...Input): void; - `); - const sdkPackage = runner.context.experimental_sdkPackage; - const method = getServiceMethodOfClient(sdkPackage); - strictEqual(method.name, "myOp"); - strictEqual(method.kind, "basic"); - strictEqual(method.parameters.length, 2); - - const methodParam = method.parameters.find((x) => x.name === "input"); - ok(methodParam); - strictEqual(methodParam.kind, "method"); - strictEqual(methodParam.optional, false); - strictEqual(methodParam.onClient, false); - strictEqual(methodParam.isApiVersionParam, false); - strictEqual(methodParam.type.kind, "model"); - - const contentTypeParam = method.parameters.find((x) => x.name === "contentType"); - ok(contentTypeParam); - strictEqual(contentTypeParam.clientDefaultValue, undefined); - strictEqual(contentTypeParam.type.kind, "constant"); - strictEqual(contentTypeParam.onClient, false); - - const serviceOperation = method.operation; - const bodyParameter = serviceOperation.bodyParam; - ok(bodyParameter); - - strictEqual(bodyParameter.kind, "body"); - deepStrictEqual(bodyParameter.contentTypes, ["application/json"]); - strictEqual(bodyParameter.defaultContentType, "application/json"); - strictEqual(bodyParameter.onClient, false); - strictEqual(bodyParameter.optional, false); - strictEqual(bodyParameter.type, sdkPackage.models[0]); - - const correspondingMethodParams = bodyParameter.correspondingMethodParams; - strictEqual(correspondingMethodParams.length, 1); - strictEqual(bodyParameter.type, correspondingMethodParams[0].type); - }); - - it("body alias spread", async () => { - await runner.compile(`@server("http://localhost:3000", "endpoint") - @service({}) - namespace My.Service; - - alias BodyParameter = { - name: string; - }; - - op myOp(...BodyParameter): void; - `); - const sdkPackage = runner.context.experimental_sdkPackage; - const method = getServiceMethodOfClient(sdkPackage); - strictEqual(sdkPackage.models.length, 1); - strictEqual(method.name, "myOp"); - strictEqual(method.kind, "basic"); - strictEqual(method.parameters.length, 2); - - const methodParam = method.parameters.find((x) => x.name === "name"); - ok(methodParam); - strictEqual(methodParam.kind, "method"); - strictEqual(methodParam.optional, false); - strictEqual(methodParam.onClient, false); - strictEqual(methodParam.isApiVersionParam, false); - strictEqual(methodParam.type.kind, "string"); - - const contentTypeMethodParam = method.parameters.find((x) => x.name === "contentType"); - ok(contentTypeMethodParam); - strictEqual(contentTypeMethodParam.clientDefaultValue, undefined); - strictEqual(contentTypeMethodParam.type.kind, "constant"); - - const serviceOperation = method.operation; - const bodyParameter = serviceOperation.bodyParam; - ok(bodyParameter); - strictEqual(bodyParameter.kind, "body"); - deepStrictEqual(bodyParameter.contentTypes, ["application/json"]); - strictEqual(bodyParameter.defaultContentType, "application/json"); - strictEqual(bodyParameter.onClient, false); - strictEqual(bodyParameter.optional, false); - strictEqual(bodyParameter.type.kind, "model"); - strictEqual(bodyParameter.type.properties.length, 1); - //eslint-disable-next-line deprecation/deprecation - strictEqual(bodyParameter.type.properties[0].nameInClient, "name"); - strictEqual(bodyParameter.type.properties[0].name, "name"); - - const correspondingMethodParams = bodyParameter.correspondingMethodParams; - strictEqual(correspondingMethodParams.length, 1); - - strictEqual( - bodyParameter.type.properties[0].nameInClient, //eslint-disable-line deprecation/deprecation - correspondingMethodParams[0].nameInClient //eslint-disable-line deprecation/deprecation - ); - strictEqual(bodyParameter.type.properties[0].name, correspondingMethodParams[0].name); - }); - - it("spread with discriminate type with implicit property", async () => { - await runner.compile(`@server("http://localhost:3000", "endpoint") - @service({}) - namespace My.Service; - - @discriminator("kind") - model Pet { - name?: string; - } - - model Dog { - kind: "dog"; - } - - model Cat { - kind: "cat"; - } - - op test(...Pet): void; - `); - const sdkPackage = runner.context.experimental_sdkPackage; - const method = getServiceMethodOfClient(sdkPackage); - strictEqual(sdkPackage.models.length, 1); - strictEqual(method.name, "test"); - strictEqual(method.kind, "basic"); - strictEqual(method.parameters.length, 2); - - const methodParam = method.parameters.find((x) => x.name === "pet"); - ok(methodParam); - strictEqual(methodParam.kind, "method"); - strictEqual(methodParam.optional, false); - strictEqual(methodParam.onClient, false); - strictEqual(methodParam.isApiVersionParam, false); - strictEqual(methodParam.type.kind, "model"); - - const contentTypeMethodParam = method.parameters.find((x) => x.name === "contentType"); - ok(contentTypeMethodParam); - strictEqual(contentTypeMethodParam.clientDefaultValue, undefined); - strictEqual(contentTypeMethodParam.type.kind, "constant"); - - const serviceOperation = method.operation; - const bodyParameter = serviceOperation.bodyParam; - ok(bodyParameter); - strictEqual(bodyParameter.kind, "body"); - deepStrictEqual(bodyParameter.contentTypes, ["application/json"]); - strictEqual(bodyParameter.defaultContentType, "application/json"); - strictEqual(bodyParameter.onClient, false); - strictEqual(bodyParameter.optional, false); - strictEqual(bodyParameter.type.kind, "model"); - strictEqual(bodyParameter.type.properties.length, 2); - //eslint-disable-next-line deprecation/deprecation - strictEqual(bodyParameter.type.properties[0].nameInClient, "kind"); - strictEqual(bodyParameter.type.properties[0].name, "kind"); - //eslint-disable-next-line deprecation/deprecation - strictEqual(bodyParameter.type.properties[1].nameInClient, "name"); - strictEqual(bodyParameter.type.properties[1].name, "name"); - - const correspondingMethodParams = bodyParameter.correspondingMethodParams; - strictEqual(correspondingMethodParams.length, 1); - strictEqual(bodyParameter.type, correspondingMethodParams[0].type); - }); - it("parameter grouping", async () => { await runner.compile(`@server("http://localhost:3000", "endpoint") @service({}) @@ -2859,8 +2695,172 @@ describe("typespec-client-generator-core: package", () => { ok(clientRequestIdProperty); strictEqual(clientRequestIdProperty.kind, "header"); }); + }); + describe("spread", () => { + it("plain model with no decorators", async () => { + await runner.compile(`@server("http://localhost:3000", "endpoint") + @service({}) + namespace My.Service; + + model Input { + key: string; + } + + op myOp(...Input): void; + `); + const sdkPackage = runner.context.experimental_sdkPackage; + const method = getServiceMethodOfClient(sdkPackage); + strictEqual(method.name, "myOp"); + strictEqual(method.kind, "basic"); + strictEqual(method.parameters.length, 2); + + const methodParam = method.parameters.find((x) => x.name === "input"); + ok(methodParam); + strictEqual(methodParam.kind, "method"); + strictEqual(methodParam.optional, false); + strictEqual(methodParam.onClient, false); + strictEqual(methodParam.isApiVersionParam, false); + strictEqual(methodParam.type.kind, "model"); + + const contentTypeParam = method.parameters.find((x) => x.name === "contentType"); + ok(contentTypeParam); + strictEqual(contentTypeParam.clientDefaultValue, undefined); + strictEqual(contentTypeParam.type.kind, "constant"); + strictEqual(contentTypeParam.onClient, false); + + const serviceOperation = method.operation; + const bodyParameter = serviceOperation.bodyParam; + ok(bodyParameter); + + strictEqual(bodyParameter.kind, "body"); + deepStrictEqual(bodyParameter.contentTypes, ["application/json"]); + strictEqual(bodyParameter.defaultContentType, "application/json"); + strictEqual(bodyParameter.onClient, false); + strictEqual(bodyParameter.optional, false); + strictEqual(bodyParameter.type, sdkPackage.models[0]); + + const correspondingMethodParams = bodyParameter.correspondingMethodParams; + strictEqual(correspondingMethodParams.length, 1); + strictEqual(bodyParameter.type, correspondingMethodParams[0].type); + }); + + it("alias with no decorators", async () => { + await runner.compile(`@server("http://localhost:3000", "endpoint") + @service({}) + namespace My.Service; - it("multiple spread", async () => { + alias BodyParameter = { + name: string; + }; + + op myOp(...BodyParameter): void; + `); + const sdkPackage = runner.context.experimental_sdkPackage; + const method = getServiceMethodOfClient(sdkPackage); + strictEqual(sdkPackage.models.length, 1); + strictEqual(method.name, "myOp"); + strictEqual(method.kind, "basic"); + strictEqual(method.parameters.length, 2); + + const methodParam = method.parameters.find((x) => x.name === "name"); + ok(methodParam); + strictEqual(methodParam.kind, "method"); + strictEqual(methodParam.optional, false); + strictEqual(methodParam.onClient, false); + strictEqual(methodParam.isApiVersionParam, false); + strictEqual(methodParam.type.kind, "string"); + + const contentTypeMethodParam = method.parameters.find((x) => x.name === "contentType"); + ok(contentTypeMethodParam); + strictEqual(contentTypeMethodParam.clientDefaultValue, undefined); + strictEqual(contentTypeMethodParam.type.kind, "constant"); + + const serviceOperation = method.operation; + const bodyParameter = serviceOperation.bodyParam; + ok(bodyParameter); + strictEqual(bodyParameter.kind, "body"); + deepStrictEqual(bodyParameter.contentTypes, ["application/json"]); + strictEqual(bodyParameter.defaultContentType, "application/json"); + strictEqual(bodyParameter.onClient, false); + strictEqual(bodyParameter.optional, false); + strictEqual(bodyParameter.type.kind, "model"); + strictEqual(bodyParameter.type.properties.length, 1); + //eslint-disable-next-line deprecation/deprecation + strictEqual(bodyParameter.type.properties[0].nameInClient, "name"); + strictEqual(bodyParameter.type.properties[0].name, "name"); + + const correspondingMethodParams = bodyParameter.correspondingMethodParams; + strictEqual(correspondingMethodParams.length, 1); + + strictEqual( + bodyParameter.type.properties[0].nameInClient, //eslint-disable-line deprecation/deprecation + correspondingMethodParams[0].nameInClient //eslint-disable-line deprecation/deprecation + ); + strictEqual(bodyParameter.type.properties[0].name, correspondingMethodParams[0].name); + }); + + it("spread with discriminate type with implicit property", async () => { + await runner.compile(`@server("http://localhost:3000", "endpoint") + @service({}) + namespace My.Service; + + @discriminator("kind") + model Pet { + name?: string; + } + + model Dog { + kind: "dog"; + } + + model Cat { + kind: "cat"; + } + + op test(...Pet): void; + `); + const sdkPackage = runner.context.experimental_sdkPackage; + const method = getServiceMethodOfClient(sdkPackage); + strictEqual(sdkPackage.models.length, 1); + strictEqual(method.name, "test"); + strictEqual(method.kind, "basic"); + strictEqual(method.parameters.length, 2); + + const methodParam = method.parameters.find((x) => x.name === "pet"); + ok(methodParam); + strictEqual(methodParam.kind, "method"); + strictEqual(methodParam.optional, false); + strictEqual(methodParam.onClient, false); + strictEqual(methodParam.isApiVersionParam, false); + strictEqual(methodParam.type.kind, "model"); + + const contentTypeMethodParam = method.parameters.find((x) => x.name === "contentType"); + ok(contentTypeMethodParam); + strictEqual(contentTypeMethodParam.clientDefaultValue, undefined); + strictEqual(contentTypeMethodParam.type.kind, "constant"); + + const serviceOperation = method.operation; + const bodyParameter = serviceOperation.bodyParam; + ok(bodyParameter); + strictEqual(bodyParameter.kind, "body"); + deepStrictEqual(bodyParameter.contentTypes, ["application/json"]); + strictEqual(bodyParameter.defaultContentType, "application/json"); + strictEqual(bodyParameter.onClient, false); + strictEqual(bodyParameter.optional, false); + strictEqual(bodyParameter.type.kind, "model"); + strictEqual(bodyParameter.type.properties.length, 2); + //eslint-disable-next-line deprecation/deprecation + strictEqual(bodyParameter.type.properties[0].nameInClient, "kind"); + strictEqual(bodyParameter.type.properties[0].name, "kind"); + //eslint-disable-next-line deprecation/deprecation + strictEqual(bodyParameter.type.properties[1].nameInClient, "name"); + strictEqual(bodyParameter.type.properties[1].name, "name"); + + const correspondingMethodParams = bodyParameter.correspondingMethodParams; + strictEqual(correspondingMethodParams.length, 1); + strictEqual(bodyParameter.type, correspondingMethodParams[0].type); + }); + it("rest template spreading of multiple models", async () => { await runner.compile(` @service({ title: "Pet Store Service", @@ -2928,7 +2928,7 @@ describe("typespec-client-generator-core: package", () => { ok(response201.type); deepStrictEqual(response200.type, response201?.type); }); - it("spread with @body in model", async () => { + it("model with @body decorator", async () => { await runner.compileWithBuiltInService(` model Shelf { name: string; @@ -2987,6 +2987,26 @@ describe("typespec-client-generator-core: package", () => { deepStrictEqual(bodyParam.type, shelfModel); deepStrictEqual(bodyParam.correspondingMethodParams, createShelfRequest.type.properties); }); + it("formdata model without body decorator in spread model", async () => { + await runner.compileWithBuiltInService(` + + model DocumentTranslateContent { + @header contentType: "multipart/form-data"; + document: bytes; + } + alias Intersected = DocumentTranslateContent & {}; + op test(...Intersected): void; + `); + const method = getServiceMethodOfClient(runner.context.experimental_sdkPackage); + const documentMethodParam = method.parameters.find((x) => x.name === "document"); + ok(documentMethodParam); + strictEqual(documentMethodParam.kind, "method"); + const op = method.operation; + ok(op.bodyParam); + strictEqual(op.bodyParam.kind, "body"); + strictEqual(op.bodyParam.name, "documentTranslateContent"); + deepStrictEqual(op.bodyParam.correspondingMethodParams, [documentMethodParam]); + }); }); describe("versioning", () => { it("define own api version param", async () => { diff --git a/packages/typespec-client-generator-core/test/test-host.ts b/packages/typespec-client-generator-core/test/test-host.ts index fd91184dab..d68f3b13e2 100644 --- a/packages/typespec-client-generator-core/test/test-host.ts +++ b/packages/typespec-client-generator-core/test/test-host.ts @@ -31,6 +31,7 @@ export async function createSdkTestHost(options: CreateSdkTestRunnerOptions = {} export interface SdkTestRunner extends BasicTestRunner { context: SdkContext; compileWithBuiltInService(code: string): Promise>; + compileWithBuiltInAzureCoreService(code: string): Promise>; compileWithCustomization(mainCode: string, clientCode: string): Promise>; compileAndDiagnoseWithCustomization( mainCode: string, @@ -132,6 +133,28 @@ export async function createSdkTestRunner( return result; }; + // compile with dummy service definition + sdkTestRunner.compileWithBuiltInAzureCoreService = + async function compileWithBuiltInAzureCoreService(code) { + const result = await baseCompile( + ` + @useDependency(Versions.v1_0_Preview_2) + @server("http://localhost:3000", "endpoint") + @service() + namespace My.Service; + ${code}`, + { + noEmit: true, + } + ); + sdkTestRunner.context = createSdkContextTestHelper( + sdkTestRunner.program, + options, + options.emitterName + ); + return result; + }; + const mainAutoCode = [ ...host.libraries .filter((x) => x !== StandardTestLibrary) diff --git a/packages/typespec-client-generator-core/test/types.test.ts b/packages/typespec-client-generator-core/test/types.test.ts index 02c4d984a9..3852540813 100644 --- a/packages/typespec-client-generator-core/test/types.test.ts +++ b/packages/typespec-client-generator-core/test/types.test.ts @@ -144,11 +144,8 @@ describe("typespec-client-generator-core: types", () => { autoUsings: ["Azure.Core"], emitterName: "@azure-tools/typespec-java", }); - await runnerWithCore.compile( + await runnerWithCore.compileWithBuiltInAzureCoreService( ` - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @service - namespace MyNamespace; @usage(Usage.input | Usage.output) @access(Access.public) model Test { @@ -182,24 +179,20 @@ describe("typespec-client-generator-core: types", () => { "filter-out-core-models": false, emitterName: "@azure-tools/typespec-java", }); - await runnerWithCore.compile(` - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @service - namespace MyService { - @resource("users") - @doc("Details about a user.") - model User { - @key - @doc("The user's name.") - @visibility("read") - name: string; - - ...Azure.Core.EtagProperty; - } + await runnerWithCore.compileWithBuiltInAzureCoreService(` + @resource("users") + @doc("Details about a user.") + model User { + @key + @doc("The user's name.") + @visibility("read") + name: string; - @doc("Gets status.") - op getStatus is GetResourceOperationStatus; - } + ...Azure.Core.EtagProperty; + } + + @doc("Gets status.") + op getStatus is GetResourceOperationStatus; `); const userModel = runnerWithCore.context.experimental_sdkPackage.models.find( (x) => x.kind === "model" && x.name === "User" @@ -993,32 +986,29 @@ describe("typespec-client-generator-core: types", () => { autoUsings: ["Azure.Core"], emitterName: "@azure-tools/typespec-java", }); - await runnerWithCore.compile(` - @service({}) - @test namespace MyService { - #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" - @doc(".") - @fixed - @usage(Usage.input | Usage.output) - @access(Access.public) - enum DaysOfWeekFixedEnum { - @doc("Monday") Monday, - @doc("Tuesday") Tuesday, - @doc("Wednesday") Wednesday, - @doc("Thursday") Thursday, - @doc("Friday") Friday, - @doc("Saturday") Saturday, - @doc("Sunday") Sunday, - } + await runnerWithCore.compileWithBuiltInAzureCoreService(` + #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" + @doc(".") + @fixed + @usage(Usage.input | Usage.output) + @access(Access.public) + enum DaysOfWeekFixedEnum { + @doc("Monday") Monday, + @doc("Tuesday") Tuesday, + @doc("Wednesday") Wednesday, + @doc("Thursday") Thursday, + @doc("Friday") Friday, + @doc("Saturday") Saturday, + @doc("Sunday") Sunday, + } - @doc(".") - @usage(Usage.input | Usage.output) - @access(Access.public) - model Test { - @doc(".") - prop: DaysOfWeekFixedEnum - } - } + @doc(".") + @usage(Usage.input | Usage.output) + @access(Access.public) + model Test { + @doc(".") + prop: DaysOfWeekFixedEnum + } `); strictEqual(runnerWithCore.context.experimental_sdkPackage.models.length, 1); strictEqual(runnerWithCore.context.experimental_sdkPackage.enums.length, 1); @@ -2192,26 +2182,21 @@ describe("typespec-client-generator-core: types", () => { autoUsings: ["Azure.Core"], emitterName: "@azure-tools/typespec-java", }); - await runnerWithCore.compile(` - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @service - namespace MyService { - - @resource("users") - @doc("Details about a user.") - model User { - @key - @doc("The user's id.") - @visibility("read") - id: int32; - - @doc("The user's name.") - name: string; - } + await runnerWithCore.compileWithBuiltInAzureCoreService(` + @resource("users") + @doc("Details about a user.") + model User { + @key + @doc("The user's id.") + @visibility("read") + id: int32; + + @doc("The user's name.") + name: string; + } - @doc("Creates or updates a User") - op createOrUpdate is ResourceCreateOrUpdate; - } + @doc("Creates or updates a User") + op createOrUpdate is ResourceCreateOrUpdate; `); const models = runnerWithCore.context.experimental_sdkPackage.models; strictEqual(models.length, 1); @@ -2225,26 +2210,21 @@ describe("typespec-client-generator-core: types", () => { "filter-out-core-models": false, emitterName: "@azure-tools/typespec-java", }); - await runnerWithCore.compile(` - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @service - namespace MyService { - - @resource("users") - @doc("Details about a user.") - model User { - @key - @doc("The user's id.") - @visibility("read") - id: int32; - - @doc("The user's name.") - name: string; - } + await runnerWithCore.compileWithBuiltInAzureCoreService(` + @resource("users") + @doc("Details about a user.") + model User { + @key + @doc("The user's id.") + @visibility("read") + id: int32; - @doc("Creates or updates a User") - op createOrUpdate is ResourceCreateOrUpdate; + @doc("The user's name.") + name: string; } + + @doc("Creates or updates a User") + op createOrUpdate is ResourceCreateOrUpdate; `); const models = runnerWithCore.context.experimental_sdkPackage.models; strictEqual(models.length, 4); @@ -2258,27 +2238,22 @@ describe("typespec-client-generator-core: types", () => { autoUsings: ["Azure.Core"], emitterName: "@azure-tools/typespec-java", }); - await runnerWithCore.compile(` - - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @service - namespace MyService { - @resource("users") - @doc("Details about a user.") - model User { - @key - @doc("The user's name.") - @visibility("read") - name: string; - } + await runnerWithCore.compileWithBuiltInAzureCoreService(` + @resource("users") + @doc("Details about a user.") + model User { + @key + @doc("The user's name.") + @visibility("read") + name: string; + } - @doc("Gets status.") - op getStatus is GetResourceOperationStatus; + @doc("Gets status.") + op getStatus is GetResourceOperationStatus; - @doc("Polls status.") - @pollingOperation(MyService.getStatus) - op createOrUpdateUser is LongRunningResourceCreateOrUpdate; - } + @doc("Polls status.") + @pollingOperation(My.Service.getStatus) + op createOrUpdateUser is LongRunningResourceCreateOrUpdate; `); const models = runnerWithCore.context.experimental_sdkPackage.models; strictEqual(models.length, 1); @@ -2292,26 +2267,22 @@ describe("typespec-client-generator-core: types", () => { "filter-out-core-models": false, emitterName: "@azure-tools/typespec-java", }); - await runnerWithCore.compile(` - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @service - namespace MyService { - @resource("users") - @doc("Details about a user.") - model User { - @key - @doc("The user's name.") - @visibility("read") - name: string; - } + await runnerWithCore.compileWithBuiltInAzureCoreService(` + @resource("users") + @doc("Details about a user.") + model User { + @key + @doc("The user's name.") + @visibility("read") + name: string; + } - @doc("Gets status.") - op getStatus is GetResourceOperationStatus; + @doc("Gets status.") + op getStatus is GetResourceOperationStatus; - @doc("Polls status.") - @pollingOperation(MyService.getStatus) - op createOrUpdateUser is LongRunningResourceCreateOrUpdate; - } + @doc("Polls status.") + @pollingOperation(My.Service.getStatus) + op createOrUpdateUser is LongRunningResourceCreateOrUpdate; `); const models = runnerWithCore.context.experimental_sdkPackage.models; strictEqual(models.length, 5);