From 48c827d57d864a175c709d905706a6c981e52535 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Fri, 6 Oct 2023 17:47:54 -0700 Subject: [PATCH] wip --- packages/openapi3/src/openapi.ts | 12 ++++++++++++ packages/openapi3/src/schema-emitter.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/openapi3/src/openapi.ts b/packages/openapi3/src/openapi.ts index 6e921f4d4c..4854c15fdc 100644 --- a/packages/openapi3/src/openapi.ts +++ b/packages/openapi3/src/openapi.ts @@ -845,6 +845,12 @@ function createOAPIEmitter( case "declaration": return { $ref: `#/components/schemas/${result.name}` }; case "circular": + reportDiagnostic(program, { + code: "inline-cycle", + format: { type: getOpenAPITypeName(program, type, typeNameOptions) }, + target: type, + }); + return {}; case "none": return {}; } @@ -858,6 +864,12 @@ function createOAPIEmitter( case "declaration": return result.value as any; case "circular": + reportDiagnostic(program, { + code: "inline-cycle", + format: { type: getOpenAPITypeName(program, type, typeNameOptions) }, + target: type, + }); + return {}; case "none": return {}; } diff --git a/packages/openapi3/src/schema-emitter.ts b/packages/openapi3/src/schema-emitter.ts index 1f4bc459e1..e6a59f81f5 100644 --- a/packages/openapi3/src/schema-emitter.ts +++ b/packages/openapi3/src/schema-emitter.ts @@ -150,7 +150,7 @@ export class OpenAPI3SchemaEmitter extends TypeEmitter< // shorten type names by removing TypeSpec and service namespace namespaceFilter(ns) { const name = getNamespaceFullName(ns); - return name !== serviceNamespaceName; // TODO FIXME + return name !== serviceNamespaceName; }, }; }