Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security schema fails on type: http #186

Closed
tajnymag opened this issue Mar 3, 2024 · 1 comment · Fixed by #197
Closed

Security schema fails on type: http #186

tajnymag opened this issue Mar 3, 2024 · 1 comment · Fixed by #197

Comments

@tajnymag
Copy link

tajnymag commented Mar 3, 2024

🐛 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

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
Copy link
Owner

toomuchdesign commented Mar 9, 2024

This specific issue and possibly a few more should have been "fixed" with #197.

The JSON schema conversion presents a few challenges which I documented here, for which I haven't found a properly satisfying solution, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants