Skip to content

Commit

Permalink
fix dup schema error
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed Oct 6, 2023
1 parent 6ef6971 commit 0c81151
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/openapi3/src/schema-emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
} from "@typespec/compiler/emitter-framework";
import { getVisibilitySuffix, MetadataInfo, Visibility } from "@typespec/http";
import {
checkDuplicateTypeName,
getExtensions,
getExternalDocs,
getOpenAPITypeName,
Expand Down Expand Up @@ -727,6 +728,12 @@ export class OpenAPI3SchemaEmitter extends TypeEmitter<
return schema;
}
const decl = this.emitter.result.declaration(name, schema);
checkDuplicateTypeName(
this.emitter.getProgram(),
type,
name,
Object.fromEntries(decl.scope.declarations.map((x) => [x.name, true]))
);
return decl;
}

Expand Down

0 comments on commit 0c81151

Please sign in to comment.