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
unresolved reference when using relative $ref #92
Comments
That's interesting. I have another workaround for you that does not force you to use absolute URLs in your refs (we are using the same thing for XDM): "allOf": [
{"$ref": "#/definitions/Project"}
] |
@trieloff good find, that is a decent workaround for the "unresolved reference" issue. Perhaps a separate issue, but I'm finding the output for a schema with many definitions far inferior to multiple schema's with absolute references. Seeing a list of all properties with a "group" soon becomes unreadable when you have a few definitions in a single schema. The links to requirements also don't work. Would it be worth creating separate issues for these? Alternatively, is it possible to use multiple absolute references in a single file? Here's a quick screenshot of some rather unwieldy output: |
I agree with @wayneashleyberry, using separate schemas results in more verbose and usable output, that often more accurately describes the schemas. For example, I have a use case where we are consuming json-schemas in oas specifications after a conversion process (with For my use case, all self-authored remote references create a chicken-before-the-egg scenario for many modern schemas where in order to validate a deep schema, the entire schema repo is required to be published to web before resuming the build process, or some clever DNS resolver hacks. It's a pipeline nightmare. For explicitly relative references, While filename is may not be suitable for most applications, it's certainly better than the current state of affairs. For example (in yaml because json is exhausting).
This would require
Synchronous, doesn't require refactoring of existing codebase. For more perfect docs...
Asynchronous, would likely require a bit of refactoring to codebase. Solves @wayneashleyberry 's issue entirely through the use of resolvers I'm considering doing the first bit myself because it's low overhead and works for my particular implementation. |
@dskvr I'm happy to review all PRs you send my way, but I'm unlikely to implement it myself. In any case, thank you for outlining the problem and approaches to solving it. |
@dskvr have you started working on this issue ? I would like to help out (to resolve it :-). Let me know. Thanks |
+1 for helping to fix this. I've just been refactoring our schemas as we have quite a few cases where there are shared components, and the output is now completely unusable, it's almost gibberish. We can't be the only ones using relative references. |
fix(schemaProxy.js): fix resolving $refs that are file references - #92
## [4.2.2](v4.2.1...v4.2.2) (2020-12-14) ### Bug Fixes * **schemaproxy.js:** fix resolving $refs that are file references ([c6adf01](c6adf01)), closes [#92](#92)
🎉 This issue has been resolved in version 4.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [4.2.2](v4.2.1...v4.2.2) (2020-12-15) ### Bug Fixes * **deps:** bump semantic-release versions ([44cc702](44cc702)) * **deps:** npm audit fix ([24a577e](24a577e)) * **deps:** update dependency @adobe/helix-log to v4.5.3 ([19f7ab4](19f7ab4)) * **schemaproxy.js:** fix resolving $refs that are file references ([c6adf01](c6adf01)), closes [#92](#92)
## [4.2.2](v4.2.1...v4.2.2) (2020-12-19) ### Bug Fixes * **deps:** bump semantic-release versions ([44cc702](44cc702)) * **deps:** npm audit fix ([24a577e](24a577e)) * **deps:** update dependency @adobe/helix-log to v4.5.3 ([19f7ab4](19f7ab4)) * **schemaproxy.js:** fix resolving $refs that are file references ([c6adf01](c6adf01)), closes [#92](#92)
## [4.2.2](v4.2.1...v4.2.2) (2021-01-02) ### Bug Fixes * **deps:** bump semantic-release versions ([44cc702](44cc702)) * **deps:** npm audit fix ([24a577e](24a577e)) * **deps:** update dependency @adobe/helix-log to v4.5.3 ([19f7ab4](19f7ab4)) * **schemaproxy.js:** fix resolving $refs that are file references ([c6adf01](c6adf01)), closes [#92](#92)
## [4.2.2](v4.2.1...v4.2.2) (2021-01-21) ### Bug Fixes * **deps:** bump semantic-release versions ([44cc702](44cc702)) * **deps:** npm audit fix ([24a577e](24a577e)) * **deps:** update dependency @adobe/helix-log to v4.5.3 ([19f7ab4](19f7ab4)) * **deps:** update dependency js-yaml to v4 ([2dbca6f](2dbca6f)) * **schemaproxy.js:** fix resolving $refs that are file references ([c6adf01](c6adf01)), closes [#92](#92)
# [5.0.0](v4.2.1...v5.0.0) (2021-01-21) ### Bug Fixes * **deps:** bump semantic-release versions ([44cc702](44cc702)) * **deps:** npm audit fix ([24a577e](24a577e)) * **deps:** update dependency @adobe/helix-log to v4.5.3 ([19f7ab4](19f7ab4)) * **deps:** update dependency js-yaml to v4 ([2dbca6f](2dbca6f)) * **schemaproxy.js:** fix resolving $refs that are file references ([c6adf01](c6adf01)), closes [#92](#92) * **traverseschema.js:** skip generating files for certain keywords in the schema ([fc50969](fc50969)) ### BREAKING CHANGES * **traverseschema.js:** The extranious files, if they have some other value, will not be generated and there is no mechanism to continue to g
🎉 This issue has been resolved in version 5.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What did you do
I tried generated markdown from a schema that makes use of relative definitions that are all in one file.
Splitting these references out into separate files with absolute URL's does work, but it makes the schema far less portable.
What did you expect to happen
Successfully generate markdown without any errors.
What happened
What's your environment
macOS 10.14.1
v11.2.0
Do you have example files:
For this schema
I'm getting following Markdown
# Schema
The text was updated successfully, but these errors were encountered: