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

TypeError: schemaObject.required?.includes is not a function #1931

Open
1 of 2 tasks
gamell opened this issue Sep 26, 2024 · 0 comments
Open
1 of 2 tasks

TypeError: schemaObject.required?.includes is not a function #1931

gamell opened this issue Sep 26, 2024 · 0 comments
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library

Comments

@gamell
Copy link

gamell commented Sep 26, 2024

Description

Getting TypeError: schemaObject.required?.includes is not a function when trying to generate types from a json OpenAPI 3.0 spec

joan.gamell@joangamell-MacBook-Pro ~/s/node-sdk (master) [1]> npx openapi-typescript https://docs.moov.io/openapi/openapi.json -o ./lib/_generated-types/types.ts
✨ openapi-typescript 7.4.1
(node:50364) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/schema-object.js:292
                let optional = schemaObject.required?.includes(k) ||
                                                      ^

TypeError: schemaObject.required?.includes is not a function
    at transformSchemaObjectCore (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/schema-object.js:292:55)
    at transformSchemaObjectWithComposition (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/schema-object.js:112:28)
    at transformSchemaObject (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/schema-object.js:6:18)
    at transformSchemaObjectCore (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/schema-object.js:303:23)
    at transformSchemaObjectWithComposition (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/schema-object.js:112:28)
    at transformSchemaObject (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/schema-object.js:6:18)
    at transformMediaTypeObject (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/media-type-object.js:7:12)
    at transformRequestBodyObject (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/request-body-object.js:15:15)
    at transformOperationObject (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/operation-object.js:13:15)
    at injectOperationObject (file:///Users/joan.gamell/src/node-sdk/node_modules/openapi-typescript/dist/transform/operation-object.js:38:18)

Node.js v22.1.0
Name Version
openapi-typescript 7.4.1
Node.js 22.1.0
OS + version macOS 14.4.1

Reproduction

npx openapi-typescript https://docs.moov.io/openapi/openapi.json -o ./lib/_generated-types/types.ts

Expected result

No errors, .ts file generated under lib/_generated-types

Checklist

@gamell gamell added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

No branches or pull requests

1 participant