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

Update spec requirements around using a default dialect #1343

Closed
gregsdennis opened this issue Oct 26, 2022 · 9 comments
Closed

Update spec requirements around using a default dialect #1343

gregsdennis opened this issue Oct 26, 2022 · 9 comments

Comments

@gregsdennis
Copy link
Member

Implementations need to use the standard validation dialect when none is specified by the schema.

@gregsdennis
Copy link
Member Author

Should we leave/add provision for an implementation to offer a configuration option for a fallback dialect (which defaults to the standard validation dialect)?

@jdesrosiers
Copy link
Member

Yes. I expect that the dialect can be declared in multiple ways. The $schema keyword is one way, a media type parameter might be another, and a configuration option is yet another. The default should only kick in if there is no dialect declared in some way. How it's declared isn't important.

@gregsdennis
Copy link
Member Author

As far as the configuration option is concerned, I would expect it to not override anything that's in a schema.

@jdesrosiers
Copy link
Member

Right, I was expecting the question of how a dialect can be declared as a separate topic, but I don't think it had an entry in my original todo list.

I expect that $schema has highest precedence, then media type parameter, then configuration.

@gregsdennis
Copy link
Member Author

... if media type parameter exists. My implementation doesn't consider media types; it deals with only content, irrespective of where that content comes from.

@handrews
Copy link
Contributor

@gregsdennis typically this would be handled by a normative requirement to accept a meta-schema URI from an external source, rather than requiring the JSON Schema implementation to be media-type aware. Some other piece of software would parse the media type and then hand off the schema and the URI from the schema media type parameter to the JSON Schema implementation.

@jdesrosiers
Copy link
Member

... if media type parameter exists. My implementation doesn't consider media types

Media types only come into play if you retrieve a schema over HTTP. Otherwise, media types and media type parameters don't apply. If you do fetch over HTTP and you are ignoring the content type of the response, I'd consider that a problem. However, although most implementations I've worked with support fetching over HTTP, very few handle media types properly.

Some other piece of software would parse the media type and then hand off the schema and the URI from the schema media type parameter to the JSON Schema implementation.

That only works for the root schema. If the implementation allows fetching references over HTTP, the fetching mechanism and media type awareness need to be built into the implementation.

@handrews
Copy link
Contributor

Reference fetching is often a plug-in architecture, and it's more that the plug-in interface needs to accept the media type (which can indeed exist in systems other than HTTP). The HTTP plugin will of course handle the media type, and if you bundle that into the implementation then, yeah, there's "implementation code" for it, but we should keep in mind that even if there is not a true plugin system, implementations aren't monoliths. The requirements for loading and processing schemas need not be conflated with requirements for retrieving remote resources.

@jdesrosiers
Copy link
Member

It was decided that we are going to put off having a default dialect for now, so I'm replacing this with #1420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants