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

fury-adapter-swagger upgrade causes Type Error #93

Closed
Farga83 opened this issue Aug 17, 2017 · 5 comments · Fixed by #99
Closed

fury-adapter-swagger upgrade causes Type Error #93

Farga83 opened this issue Aug 17, 2017 · 5 comments · Fixed by #99
Assignees
Labels

Comments

@Farga83
Copy link

Farga83 commented Aug 17, 2017

The most recent release included an upgrade to fury and minim dependencies. With those changes I get the following error when trying to run dredd.

/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:52
      element.parent = this;
                     ^

TypeError: Cannot assign to read only property 'parent' of object '#<AuthScheme>'
    at constructor.<anonymous> (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:52:22)
    at Array.forEach (<anonymous>:null:null)
    at constructor.forEach (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/array-slice.js:58:19)
    at constructor.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:51:19)
    at constructor.<anonymous> (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:53:15)
    at Array.forEach (<anonymous>:null:null)
    at constructor.forEach (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/array-slice.js:58:19)
    at constructor.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:51:19)
    at constructor.<anonymous> (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:53:15)
    at Array.forEach (<anonymous>:null:null)
    at constructor.forEach (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/array-slice.js:58:19)
    at constructor.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:51:19)
    at HttpTransaction.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:48:23)
    at Transition.<anonymous> (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:53:15)
    at Array.forEach (<anonymous>:null:null)
    at constructor.forEach (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/array-slice.js:58:19)
    at Transition.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:51:19)
    at Resource.<anonymous> (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:53:15)
    at Array.forEach (<anonymous>:null:null)
    at constructor.forEach (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/array-slice.js:58:19)
    at Resource.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:51:19)
    at Category.<anonymous> (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:53:15)
    at Array.forEach (<anonymous>:null:null)
    at constructor.forEach (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/array-slice.js:58:19)
    at Category.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:51:19)
    at ParseResult.<anonymous> (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:53:15)
    at Array.forEach (<anonymous>:null:null)
    at constructor.forEach (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/array-slice.js:58:19)
    at ParseResult.freeze (/usr/local/lib/node_modules/dredd/node_modules/minim/lib/primitives/element.js:51:19)
    at /usr/local/lib/node_modules/dredd/node_modules/dredd-transactions/lib/parse.js:42:19
    at /usr/local/lib/node_modules/dredd/node_modules/fury/lib/fury.js:169:13
    at complete (/usr/local/lib/node_modules/dredd/node_modules/fury-adapter-swagger/lib/parser.js:258:20)
    at /usr/local/lib/node_modules/dredd/node_modules/fury-adapter-swagger/lib/parser.js:280:17
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

To reproduce, simply do a fresh install of dredd as outlined here
http://dredd.readthedocs.io/en/latest/installation.html and run dredd against a swagger.yaml file.

To work around the issue, manually update dredd/packages.json restricting the version.

I believe the commit introducing the issue is ea91dc6

@kylef kylef self-assigned this Aug 17, 2017
@anth0d
Copy link

anth0d commented Aug 17, 2017

Thanks for opening! 👍 This is affecting me today as well.

anth0d referenced this issue in apiaryio/dredd Aug 17, 2017
@kylef
Copy link
Member

kylef commented Aug 17, 2017

Could either of you please share your Swagger file (or a smaller variant that can reproduce the problem). It isn't just any Swagger document that would cause the problem. If you don't want to post it here publicly feel free to email it to me at kyle.fuller@oracle.com and I should be able to fix it shortly, the problem most likely in fury-adapter-swagger.

Regards,

Kyle

@Farga83
Copy link
Author

Farga83 commented Aug 17, 2017

petstore.yaml.zip

Here's what makes it fail

securityDefinitions:
  Bearer:
    type: apiKey
    name: Authorization
    in: header

security:
  - Bearer: []

@kylef
Copy link
Member

kylef commented Aug 17, 2017

Thanks @Farga83, I've prepared a fix in apiaryio/fury-adapter-swagger#120. Should get this out shortly.

@Farga83 Farga83 changed the title Minim upgrade causes Type Error fury-adapter-swagger upgrade causes Type Error Aug 17, 2017
anth0d added a commit to anth0d/dredd that referenced this issue Aug 18, 2017
anth0d added a commit to anth0d/dredd that referenced this issue Aug 18, 2017
@honzajavorek
Copy link
Contributor

honzajavorek commented Aug 18, 2017

This has been fixed in the Fury adapter, but not in Dredd Transactions yet. I'm also thinking about whether it's worth writing a test, since the bug made Dredd unusable to anyone with auth in their Swagger, but there was no test to catch this either in DT or Dredd itself.

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

Successfully merging a pull request may close this issue.

4 participants