From d0c8551c8d77d7fc70e58af7d4322b436e8b544d Mon Sep 17 00:00:00 2001 From: mcgallan <88413158+mcgallan@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:24:15 +0800 Subject: [PATCH 1/2] Fix NameSpace In Flatten-Property (#709) update --- .changeset/forty-brooms-fix.md | 5 +++++ .../azure/client-generator-core/flatten-property/main.tsp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/forty-brooms-fix.md diff --git a/.changeset/forty-brooms-fix.md b/.changeset/forty-brooms-fix.md new file mode 100644 index 000000000..ff2d5e4f1 --- /dev/null +++ b/.changeset/forty-brooms-fix.md @@ -0,0 +1,5 @@ +--- +"@azure-tools/cadl-ranch-specs": minor +--- + +Fix some minor issues in the namespace of azure/client-generate-core/flatten-property. diff --git a/packages/cadl-ranch-specs/http/azure/client-generator-core/flatten-property/main.tsp b/packages/cadl-ranch-specs/http/azure/client-generator-core/flatten-property/main.tsp index 35a7e82ee..e84aaa145 100644 --- a/packages/cadl-ranch-specs/http/azure/client-generator-core/flatten-property/main.tsp +++ b/packages/cadl-ranch-specs/http/azure/client-generator-core/flatten-property/main.tsp @@ -3,11 +3,11 @@ import "@azure-tools/cadl-ranch-expect"; import "@azure-tools/typespec-client-generator-core"; using TypeSpec.Http; -using Azure.ClientGenerator.Core; +using global.Azure.ClientGenerator.Core; @doc("Illustrates the model flatten cases.") @scenarioService("/azure/client-generator-core/flatten-property") -namespace Azure.ClientGenerator.Core.FlattenProperty; +namespace _Specs_.Azure.ClientGenerator.Core.FlattenProperty; @doc("This is the model with one level of flattening.") model FlattenModel { From 039ab07e8cc5ee9c7805fd3a656eaebb66260aec Mon Sep 17 00:00:00 2001 From: Mingzhe Huang Date: Sat, 24 Aug 2024 00:53:45 +0800 Subject: [PATCH 2/2] fix(decorator): replace hard code url with `{endpoint}` in `@scenarioService` (#598) --- .changeset/gold-horses-brake.md | 5 +++++ packages/cadl-ranch-expect/src/decorators.ts | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changeset/gold-horses-brake.md diff --git a/.changeset/gold-horses-brake.md b/.changeset/gold-horses-brake.md new file mode 100644 index 000000000..5b73acf9a --- /dev/null +++ b/.changeset/gold-horses-brake.md @@ -0,0 +1,5 @@ +--- +"@azure-tools/cadl-ranch-expect": patch +--- + +fix(decorator): replace hard code url with `{endpoint}` in `@scenarioService` diff --git a/packages/cadl-ranch-expect/src/decorators.ts b/packages/cadl-ranch-expect/src/decorators.ts index b706467af..294285e53 100644 --- a/packages/cadl-ranch-expect/src/decorators.ts +++ b/packages/cadl-ranch-expect/src/decorators.ts @@ -238,6 +238,20 @@ export function $scenarioService( derivedModels: [], projectionsByName: [], } as any); - context.call($server, target, "http://localhost:3000", "TestServer endpoint"); + + context.call($server, target, "{endpoint}", "Test server endpoint", { + kind: "Model", + properties: new Map().set("endpoint", { + name: "endpoint", + type: context.program!.getGlobalNamespaceType().namespaces.get("TypeSpec")!.scalars.get("string"), + defaultValue: { entityKind: "Value", valueKind: "StringValue", value: "http://localhost:3000" }, + }), + decorators: [], + projections: [], + name: "parameters", + derivedModels: [], + projectionsByName: [], + } as any); + context.call($route, target, route); }