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

Cannot read property 'items' of undefined #133

Closed
elie222 opened this issue Feb 4, 2020 · 4 comments
Closed

Cannot read property 'items' of undefined #133

elie222 opened this issue Feb 4, 2020 · 4 comments

Comments

@elie222
Copy link

elie222 commented Feb 4, 2020

Release 1.6.1 introduced a bug. When running the generator we get:

Error: TypeError: Cannot read property 'items' of undefined

Related code:

    if ($ref) {
      const [refName, refProperties] = getRef($ref);
      const convertedRefName = spacesToUnderscores(refName);

      if (refProperties.items && refProperties.items.$ref) {
        return getType(refProperties, refName);
      }

Works fine for us in 1.6.0 and 1.5.x.

@elie222 elie222 changed the title Breaking change in 1.6.1 Cannot read property 'items' of undefined Feb 4, 2020
@drwpow
Copy link
Contributor

drwpow commented Apr 5, 2020

Hey @elie222 thanks for reporting this. Are you able to provide an example of your schema that breaks this?

Also you may be interested in an improved 2.0 version of this library which is currently in alpha, that also may fix the problem.

@elie222
Copy link
Author

elie222 commented Apr 5, 2020

Thanks. We found a workaround for the issue at the time. It’s a project I finished working on in any case but I’ll let the others know that v2 could be worth checking out. Thanks!

@drwpow
Copy link
Contributor

drwpow commented Apr 5, 2020

Glad you got it sorted. Also sorry for the inconvenience!

@drwpow
Copy link
Contributor

drwpow commented May 5, 2020

@manifoldco/swagger-to-ts@2.0.0 was just released on npm, which is a library rewrite that adds OpenAPI 3.0 support as well as fixes a myriad of issues. I believe this will fix your issue, but please let me know if this pops up again.

@drwpow drwpow closed this as completed May 5, 2020
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

2 participants