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

Taming error messages #40

Closed
wants to merge 2 commits into from
Closed

Taming error messages #40

wants to merge 2 commits into from

Conversation

philsturgeon
Copy link
Contributor

Truncate any assertion-based linter errors

expected Object {
  openapi: '3.0.0',
   info: Object { version: '1.0.0', title: 'Swagger 2.0 Without Scheme'
  },
  paths: Object {},
  components: Object {
  ... snip ...
} to have property tags

This will also show a considerably more concise JSON Schema error in situations where speccy knows
whats up.

Specification schema is invalid.
  /components has an unexpected additional property: properties

@coveralls
Copy link

coveralls commented Apr 3, 2018

Coverage Status

Coverage decreased (-0.1%) to 64.894% when pulling ce4addf on tame-error-messages into 14fb75a on master.

This will show a much more concise error in situations where speccy knows whats up.

```
Specification schema is invalid.

/components has an unexpected additional property: properties
```
```
expected Object {
  openapi: '3.0.0',
  info: Object { version: '1.0.0', title: 'Swagger 2.0 Without Scheme'
},
  paths: Object {},
  components: Object {
  ... snip ...
} to have property tags
```
@philsturgeon
Copy link
Contributor Author

philsturgeon commented Apr 4, 2018

Holy crap, https://github.com/torifat/better-ajv-errors looks amazing. @MikeRalphson pointed this one out, and I want it, but... it's kinda funny. These JSON Schema errors should only show up as a last resort, as "This utterly failed and we (speccy validator) do not know why."

image

To have this backup method be so much more fantastic looking in output seems a tad odd IMO :D

I wonder if we can promote the usage of the OpenAPI v3.0.0 metadata (unofficial as it is 😅) to essentially first-pass any file it comes across, giving us this taaasty input first?

What ya think folks?

@MikeRalphson
Copy link
Contributor

You just need to hoik the ajv validation out to its own function and have an option to run it first, last or never (setting whatever default you prefer). Up to you if you want to wait for openapi-kit?

@philsturgeon
Copy link
Contributor Author

Replaced with #47

@philsturgeon philsturgeon deleted the tame-error-messages branch April 9, 2018 15:54
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

Successfully merging this pull request may close these issues.

3 participants