From 3f6812bb583d72eee26ff734fabc15e227d54f91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 14:13:13 +0000 Subject: [PATCH 1/6] Bump core from `1d6d1ce` to `8ed1d82` Bumps [core](https://github.com/microsoft/typespec) from `1d6d1ce` to `8ed1d82`. - [Commits](https://github.com/microsoft/typespec/compare/1d6d1ce739d87a4411b3136b2beb67132bcb821d...8ed1d82e7ccb0a8b72ae902149b86d68ac684872) --- updated-dependencies: - dependency-name: core dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core b/core index 1d6d1ce739..8ed1d82e7c 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 1d6d1ce739d87a4411b3136b2beb67132bcb821d +Subproject commit 8ed1d82e7ccb0a8b72ae902149b86d68ac684872 From e77b3134d09272120e9ab4e84aa52b0fc80936cb Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 6 Feb 2024 08:37:49 -0800 Subject: [PATCH 2/6] OpenIDConnect unsupported in swagger 2.0 --- packages/typespec-autorest/src/lib.ts | 6 ++++++ packages/typespec-autorest/src/openapi.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/typespec-autorest/src/lib.ts b/packages/typespec-autorest/src/lib.ts index d4a63b446e..92c647287d 100644 --- a/packages/typespec-autorest/src/lib.ts +++ b/packages/typespec-autorest/src/lib.ts @@ -316,6 +316,12 @@ const libDef = { default: paramMessage`'${"schema"}' format '${"format"}' is not supported in Autorest. It will not be emitted.`, }, }, + "unsupported-auth": { + severity: "warning", + messages: { + default: paramMessage`Authentication "${"authType"}" is not a known authentication by the openapi3 emitter, it will be ignored.`, + }, + }, }, emitter: { options: EmitterOptionsSchema as JSONSchemaType, diff --git a/packages/typespec-autorest/src/openapi.ts b/packages/typespec-autorest/src/openapi.ts index f148cb986a..21ae4f1b7a 100644 --- a/packages/typespec-autorest/src/openapi.ts +++ b/packages/typespec-autorest/src/openapi.ts @@ -282,6 +282,7 @@ function createOAPIEmitter( }, }; let root: OpenAPI2Document; + let currentService: Service; let currentEndpoint: OpenAPI2Operation; let currentConsumes: Set; let currentProduces: Set; @@ -327,6 +328,7 @@ function createOAPIEmitter( services.push({ type: program.getGlobalNamespaceType() }); } for (const service of services) { + currentService = service; const originalProgram = program; const versions = buildVersionProjections(program, service.type).filter( (v) => !options.version || options.version === v.version @@ -2228,9 +2230,13 @@ function createOAPIEmitter( } as any, flow.scopes.map((x) => x.value), ]; + case "openIdConnect": default: - const _assertNever: never = auth; - compilerAssert(false, "Unreachable"); + reportDiagnostic(program, { + code: "unsupported-auth", + format: { authType: (auth as any).type }, + target: currentService.type, + }); } } From facbc292314951298081d69749cac25f8352f9a2 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 6 Feb 2024 08:39:56 -0800 Subject: [PATCH 3/6] changelog --- .changeset/sour-brooms-mix.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sour-brooms-mix.md diff --git a/.changeset/sour-brooms-mix.md b/.changeset/sour-brooms-mix.md new file mode 100644 index 0000000000..6c20620422 --- /dev/null +++ b/.changeset/sour-brooms-mix.md @@ -0,0 +1,5 @@ +--- +"@azure-tools/typespec-autorest": patch +--- + +Emit warning if using opendIdConnect http auth scheme From be6b6c403d20642922165bcbf094b3c20e0d81c5 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 6 Feb 2024 09:17:50 -0800 Subject: [PATCH 4/6] Fix error --- packages/typespec-autorest/src/openapi.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typespec-autorest/src/openapi.ts b/packages/typespec-autorest/src/openapi.ts index 21ae4f1b7a..0a57f14d74 100644 --- a/packages/typespec-autorest/src/openapi.ts +++ b/packages/typespec-autorest/src/openapi.ts @@ -2237,6 +2237,7 @@ function createOAPIEmitter( format: { authType: (auth as any).type }, target: currentService.type, }); + return undefined; } } From 09b861f8d54905648ddf82e8bb7c9dddf7fba8e7 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 6 Feb 2024 10:09:02 -0800 Subject: [PATCH 5/6] test with this format? --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 297781d978..2da964aa8e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "packageManager": "pnpm@8.13.1", "scripts": { - "run-all": "pnpm -r --filter='!./core'", + "run-all": "pnpm -r --filter='!./core/'", "build": "pnpm run-all --workspace-concurrency=Infinity --aggregate-output --reporter=append-only build ", "check-format": "pnpm run prettier --check", "check-version-mismatch": "syncpack list-mismatches", From d20ecd72a87efbd74c3f16b42d428c14a9c6f4e6 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 6 Feb 2024 10:18:09 -0800 Subject: [PATCH 6/6] try this --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2da964aa8e..b6cbf63933 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "packageManager": "pnpm@8.13.1", "scripts": { - "run-all": "pnpm -r --filter='!./core/'", + "run-all": "pnpm -r --filter=!./core/", "build": "pnpm run-all --workspace-concurrency=Infinity --aggregate-output --reporter=append-only build ", "check-format": "pnpm run prettier --check", "check-version-mismatch": "syncpack list-mismatches",