-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Possibility to add onBundle
callback?
#346
Comments
That sounds reasonable, we'd add the feature if you make a PR |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! This is just an issue to get your opinion on adding a new
onBundle
callback as part of theoptions
object, similar toonDereference
. I'm willing to contribute this, if you're open to adding this feature. Here's some context on why we need it:We use json-schema-ref-parser to parse and bundle OpenAPI and AsyncAPI files, heavily relying on overriding the resolvers to fetch external references from GitHub.
One issue with that is: if external
$ref
contains$schema
and$id
- thebundle()
function keeps them, but the resulting OpenAPI document fails validation, due to unexpected additional properties. Here's a concrete minimal example:schema.json
api.yaml
script.ts
bundledApi.yaml
This fails validation with:
Removing
$schema
and$id
would make it pass the validation, however there doesn't seem to be an easy way of doing that. If we were callingdereference()
instead ofbundle()
- the problem would be trivially solved with something like this:Do you think adding the possibility to pass in an
onBundle
callback would make sense here? Or can our problem be solved in some other way? Appreciate any feedback.The text was updated successfully, but these errors were encountered: