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

Support for pluggable filters in the resolver #65

Closed
MikeRalphson opened this issue Apr 5, 2018 · 8 comments
Closed

Support for pluggable filters in the resolver #65

MikeRalphson opened this issue Apr 5, 2018 · 8 comments

Comments

@MikeRalphson
Copy link
Contributor

As discussed with @philsturgeon - this would allow pulling JSON schema documents and having them magically transformed into OpenAPI schema objects.

@philsturgeon
Copy link

Example of a filter, the JSON Schema to OpenAPI conversion layer that goes into each of the different protocol things. wework/speccy#45

@MikeRalphson
Copy link
Contributor Author

Cool. Will probably be implemented as an array of callbacks which can mutate the content. Do you think anyone is ever going to want to massage the text before it gets parsed by js-yaml ?

@philsturgeon
Copy link

I can only guess, but for me no.

@MikeRalphson
Copy link
Contributor Author

Good, simpler the better.

@MikeRalphson
Copy link
Contributor Author

options.filters is now an (optional) array of functions which take two parameters, data and options and must return the filtered data.

oas-kit should be a step towards re-integrating speccy with the new oas-resolver package and possibly oas-validator in the future (you would provide your own linter presumably which would be plugged in instead of oas-linter).

@philsturgeon
Copy link

Sweet! Is this ready for me to rewrite speccy around or what's the deal?

@MikeRalphson MikeRalphson reopened this Jun 27, 2018
@MikeRalphson
Copy link
Contributor Author

I think the refactoring of swagger2openapi into oas-kit as a mono-repo is now stable. I don't believe you made any other changes to the resolver apart from the ability to plug in your JSON-Schema dialect converter? If that's the case, then switching over to using oas-resolver as a dependency should be pretty trivial.

It will take a little longer for me to work out whether the validator changes can be sync'd up again, and if so what changes if any are needed to the interface between the validator and the linter.

I'm happy to do anything to reduce the code duplication between the projects, but I know you were at least toying with the idea of using ajv (with better-ajv-errors) as the primary validator. oas-validator now has an option to do ajv first, last or never, but ajv-errors-are-still-pretty-shit :)

@MikeRalphson
Copy link
Contributor Author

Work being done in wework/speccy#98

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