-
Notifications
You must be signed in to change notification settings - Fork 13
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
Proposal: opt-in opinionated mode #74
Comments
Any global switch for non-compliant behaviour is potentially problematic, because (a) it requires digging into code or documentation to find out exactly what an enabled switch entails, (b) what it entails can change from one release to the next, and (c) it forces non-compliance across multiple spec requirements even if only one such adaptation is needed. I think any point of divergence between spec and implementation should be addressed on its own merits. In cases where non-compliant behaviour makes sense, this could be enabled with a specific switch (probably a kwarg to create_catalog). This way, application code is explicit about enabling any non-compliant behaviour, and that behaviour can be clearly documented along with the switch that enables it. We can look at specific switches as part of the above issues/PRs. |
@marksparkza sounds good to me - I'd actually prefer not to have such switches for exactly this reason:
I was just sympathetic with some of the technically non-compliant choices and exploring options. I'm plenty happy to not do anything about it! |
jschon
includes three sensible but technically non-compliant checks:$dynamicRef
to plain name fragments (issue "$dynamicRef" to non-dynamic URI #64)$id
values (issue "$id" is (slightly) non-compliant (hidden by errors in JSON Schema Test Suite) #69)$id
in 2019-09 and 2020-12 (also issue "$id" is (slightly) non-compliant (hidden by errors in JSON Schema Test Suite) #69)PR #66 simply removes the
$dynamicRef
check, but the check is only non-compliant if it is on by default. An alternative could be to offer an opt-in "opinionated mode" that can be configured on theCatalog
instance.I'm suggesting "opinionated mode" rather than "strict mode" because AJV's "strict mode" is problematic and confusing, and I'd advise against anything that sounds like it. Although I'm not particularly attached to "opinionated mode", it just feels like truth in advertising :-)
I considered referring to this as linting, but because of how references are resolved and loaded, it's difficult to check everything up front as one would expect from a linter. A mode that raises runtime errors for things that are compliant but viewed by
jschon
(a.k.a. @marksparkza 😉) as worth excluding would fit the current architecture quite easily.I don't feel at all strongly about this, it just occurred to me as an alternative to simply removing the checks that the spec technically forbids.
The text was updated successfully, but these errors were encountered: