diff --git a/packages/openapi3/src/schema-emitter.ts b/packages/openapi3/src/schema-emitter.ts index a6970792702..520d8503af6 100644 --- a/packages/openapi3/src/schema-emitter.ts +++ b/packages/openapi3/src/schema-emitter.ts @@ -720,7 +720,13 @@ export class OpenAPI3SchemaEmitterBase< for (const [key, model] of variants.entries()) { const ref = this.emitter.emitTypeReference(model); compilerAssert(ref.kind === "code", "Unexpected ref schema. Should be kind: code"); - mapping[key] = (ref.value as any).$ref; + if (ref.value instanceof Placeholder) { + ref.value.onValue((resolvedValue) => { + mapping[key] = (resolvedValue as any).$ref; + }); + } else { + mapping[key] = (ref.value as any).$ref; + } } return mapping; }