Security schema fails on `type: http`
Closed this issue ยท 1 comments
tajnymag commented
๐ Bug Report
Generator validates incorrectly security schemas with type: http
and scheme: bearer
and rejects it.
To reproduce, I've created a test repository and a test workflow. The issue happens both on windows and linux.
Reproduction
- repository: https://github.com/tajnymag/openapi-ts-json-schema-poc
- generator: https://github.com/tajnymag/openapi-ts-json-schema-poc/blob/main/test-bearer-type-error.cjs
- specification: https://github.com/tajnymag/openapi-ts-json-schema-poc/blob/main/bearer-type-error.yaml
- action run: https://github.com/tajnymag/openapi-ts-json-schema-poc/actions/runs/8132010880/job/22221963169
Expected behavior
Specification should be considered valid and schemas should be generated normally.
Actual behavior
InvalidTypeError: Type "http" is not a valid type
at validateType (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\@openapi-contrib\openapi-schema-to-json-schema\dist\lib\converters\schema.js:93:15)
at convertSchema (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\@openapi-contrib\openapi-schema-to-json-schema\dist\lib\converters\schema.js:75:9)
at convertProperties (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\@openapi-contrib\openapi-schema-to-json-schema\dist\lib\converters\schema.js:112:22)
at convertSchema (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\@openapi-contrib\openapi-schema-to-json-schema\dist\lib\converters\schema.js:58:39)
at convertFromSchema (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\@openapi-contrib\openapi-schema-to-json-schema\dist\lib\converters\schema.js:14:23)
at openapiSchemaToJsonSchema (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\@openapi-contrib\openapi-schema-to-json-schema\dist\index.js:52:37)
at convertOpenApiToJsonSchema (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\openapi-ts-json-schema\dist\utils\convertOpenApiToJsonSchema.js:16:71)
at openapiToTsJsonSchema (C:\Users\marek\GitHub\openapi-ts-json-schema-poc\node_modules\openapi-ts-json-schema\dist\openapiToTsJsonSchema.js:30:70)
at async waitForActual (node:assert:800:5)
at async Function.doesNotReject (node:assert:941:33)
Run npx envinfo --preset jest
Paste the results here:
System:
OS: Windows 11 10.0.22631
CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700K
Binaries:
Node: 21.6.2 - ~\scoop\apps\nodejs\current\node.EXE
Yarn: 1.22.19 - ~\scoop\apps\nodejs\current\yarn.CMD
npm: 10.2.4 - ~\scoop\apps\nodejs\current\npm.CMD
pnpm: 8.15.3 - ~\scoop\apps\nodejs\current\pnpm.CMD
toomuchdesign commented