diff --git a/.changeset/itchy-owls-beg.md b/.changeset/itchy-owls-beg.md new file mode 100644 index 000000000..1ec22af62 --- /dev/null +++ b/.changeset/itchy-owls-beg.md @@ -0,0 +1,5 @@ +--- +"swagger-typescript-api": patch +--- + +Fix being able to call getComponentByRef from templates diff --git a/src/schema-components-map.ts b/src/schema-components-map.ts index 6ddc4dcc4..8eee01181 100644 --- a/src/schema-components-map.ts +++ b/src/schema-components-map.ts @@ -65,9 +65,9 @@ export class SchemaComponentsMap { ); } - get($ref: string) { + get = ($ref: string) => { return this._data.find((c) => c.$ref === $ref) || null; - } + }; // Ensure enums are at the top of components list enumsFirst() {