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

openapi-io-ts generator script thrown an error #19

Open
paololim opened this issue Jul 11, 2022 · 0 comments
Open

openapi-io-ts generator script thrown an error #19

paololim opened this issue Jul 11, 2022 · 0 comments

Comments

@paololim
Copy link

We are running into an issue generating for our project. The instructions in the readme were followed, and summarized below as follows.

Added to package.json as a devDependency using:

npm i -D @openapi-io-ts/cli

Added a command in our package.json using:

scripts: {
  ...
  "openapi-io-ts:generate": "openapi-io-ts -i apps/dashboard-api/src/docs/openapi.yaml -o apps/dashboard-api/src/codecs/generated",
  ...
}

Note that apps/dashboard-api/src/docs/openapi.yaml is a valid openapi format using:

openapi: 3.0.1

We get the following:

$ npm run openapi-io-ts:generate

> dynamic@0.0.0 openapi-io-ts:generate
> openapi-io-ts -i apps/dashboard-api/src/docs/openapi.yaml -o apps/dashboard-api/src/codecs/generated

/Users/paolo/Dyn/redcoast/node_modules/@openapi-io-ts/cli/dist/bin.js:981
  return (0, import_function16.pipe)(RTE12.Do, RTE12.bind("schema", () => JsonReference.is(s) ? getOpenapiSchemaFromRef(s) : RTE12.right(s)), RTE12.map((obj) => obj.schema.default));
                                                                                                                                                                            ^
TypeError: Cannot read properties of undefined (reading 'default')
    at /Users/paolo/Dyn/redcoast/node_modules/@openapi-io-ts/cli/dist/bin.js:981:173
    at /Users/paolo/Dyn/redcoast/node_modules/fp-ts/lib/Either.js:268:52
    at Object.pipe (/Users/paolo/Dyn/redcoast/node_modules/fp-ts/lib/function.js:286:20)
    at Object._map [as map] (/Users/paolo/Dyn/redcoast/node_modules/fp-ts/lib/Either.js:56:49)
    at /Users/paolo/Dyn/redcoast/node_modules/fp-ts/lib/Functor.js:19:92

My expectation is that the command will generate the the necessary files based on the openapi.yml file passed in as a parameter. Is there something I am missing here? Thanks!

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

No branches or pull requests

1 participant