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

Unsupported types fail without reporting why #164

Closed
bagmangood opened this issue Sep 18, 2018 · 4 comments
Closed

Unsupported types fail without reporting why #164

bagmangood opened this issue Sep 18, 2018 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@bagmangood
Copy link

Detailed description

If an unsupported type is used in a json file (other than Data Types), the linter will solely output err is not defined.

It does report properly in a yaml file

To Replicate

  1. Create a json file for some portion of your documentation.
  2. Instead of a supported datatype, put foo.
  3. Run the linter
  4. Profit
@bagmangood bagmangood added the bug Something isn't working label Sep 18, 2018
@MikeRalphson
Copy link
Contributor

@philsturgeon do you think this could be related to Mermade/oas-kit#78 or is it a separate issue?

@philsturgeon
Copy link
Contributor

Sadly not @MikeRalphson, it's only when using -j and the invalid type is in a JSON Schema file.

The json-schema-to-openapi-schema library is throwing an exception that the oas-kit filter logic is not expecting.

▶ node speccy lint test/samples/json-schema/openapi.yaml -j --verbose
GET /Users/philsturgeon/src/speccy/rules/default.json
.. snip ..
GET test/samples/json-schema/openapi.yaml
GET /Users/philsturgeon/src/speccy/test/samples/json-schema/a.json
{ Error
    at Object.<anonymous> (/Users/philsturgeon/src/speccy/node_modules/json-schema-to-openapi-schema/index.js:8:30)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/philsturgeon/src/speccy/lint.js:9:24)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
  name: 'InvalidTypeError',
  message: 'Type "foo" is not a valid type' }
ReferenceError: err is not defined
    at /Users/philsturgeon/src/speccy/node_modules/oas-resolver/index.js:215:26
ReferenceError: err is not defined
    at /Users/philsturgeon/src/speccy/node_modules/oas-resolver/index.js:215:26
err is not defined

Not sure what to do about this.

@philsturgeon philsturgeon added this to the 0.9.0 milestone Oct 15, 2018
@MikeRalphson
Copy link
Contributor

@philsturgeon The throwing of the undefined err (when it should be ex) is fixed in oas-resolver v1.0.10

@philsturgeon
Copy link
Contributor

Confirmed! Thank you so much @MikeRalphson.

$ speccy lint test/samples/json-schema/openapi.yaml -j
err is not defined
$ node speccy lint test/samples/json-schema/openapi.yaml -j
Type "foo" is not a valid type

This will be fixed by #181.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants