-
Notifications
You must be signed in to change notification settings - Fork 114
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
[JSON Schema] Support for schema.Reference #36
Comments
Yes, you can't modify the content of the reference from the parent document in the current state of the code. |
For JSON Schema used with the Swagger 2.0 specification (a.k.a. OPEN API Specification), we can actually avoid the Swagger 2.0 defines all payloads for an API under the "definitions" parameter in the root schema. Therefore, we can refer to the ref validator schema definition as Note that {TypeName} is most correctly spelled singular and possibly capitalized, so it should not be taken directly from the reference path. The reference path can also be deep. This must however be solved anyway to enable Swagger 2.0 documentation, so it's not a Reference specific problem. |
UPDATE: if #100 is fixed/merged, there is an opportunity to access the Validator of the linked ID we are targeting if the schema is registered with a This way we could embed an actual validator for the field rather than a reference, and we do not have to implement Swagger 2.0 support in order to close this issue. |
The way this has been implemented, the related validator is kept private. I want to revisit how JSON Schema (and ptentially other doc formats) gets generated after #77, so I am dropping this from the 0.2 milestone. |
UPDATED
This ticket is now about extending
schema.Reference
support in theschema/encoding/jsonschema
package when adding support for the OpenAPI Specification (a.k.a. the Swagger 2.0. specification).More specifically, schema.Reference fields should be encoded as
{"$ref": "#definitions/<unique resource path>/id"}
when encoding a schema for an OpenAPI Specification resource.This might require:
PS! This ticket is currently blocked on adding initial support for the OpenAPI Specification.
The text was updated successfully, but these errors were encountered: