Comments (9)
This sounds reasonable, other than the fact that name
makes me really confused. It's not officially mentioned in the schema, so it's not clear if it's actually special in any way.
I'd want to clarify that, because if it isn't special then using it for this would be dirty, but if it is, then this would be OK – maybe you want to take a shot at it :)? If not, you can leave this open.
from jsonschema.
Hmm, you appear to be right. I was just looking at all the examples in the draft having that property, which made me think it was part of the spec. The only discussion on it I found was here. https://groups.google.com/d/msg/json-schema/TAquHyF9lXg/3tyhmC7dI2YJ
I could certainly contribute a solution if you have any ideas on how it could be done cleanly, can't think of anything myself that might not give unexpected results outside of my scope right now.
I am thinking of moving from a custom validator system we have in our project (FlexGet) to using json schema, but do not want to give users cryptic errors. Maybe I'll just override the validate_type method in order to give custom errors for our project.
from jsonschema.
That would be a thing you could do certainly. Just extend it, call up using super
to actually validate, and re-raise a different ValidationError
using whatever property your application likes.
from jsonschema.
Yeah, I might just override it outright, as I'm thinking we also want to display the subschema error message when we can detect which they meant. (we often have 'simple' form, of just a boolean, and 'advanced' form accepting an object) It'll probably be nice for us to display the actual object error message when users create a dict rather than a bool. All rather specific to our project though, I was just thinking maybe some of it could have been upsteam at first. Thanks for the nice project though. :)
from jsonschema.
No, certainly -- I agree with this in principle, readability is good, no one wants a huge splatted traceback, it's just unfortunate that draft 3 doesn't have this in it.
At some point when it actually exists in a reasonable form jsonschema
will support draft 4, and it sounds like that might introduce something that'd help you, so perhaps then we can revisit this.
from jsonschema.
Oh hmm, just saw 'title' is mentioned in draft 3. Maybe that could be used. https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
from jsonschema.
Well, see, it's not just a question of what can be used -- name
can be used just as well as title
, it's a question of what is used. I'm still not sure title
, even though it's part of the schema, is used for any significant purpose. The thing I'd rather not do (which of course the application can still choose to) is add significance that is local to the validation library that in fact isn't present in the schema or its use.
So I guess what I'm saying is I still need to look around to see if in fact title
is used for this (naming a schema, or naming it well enough to call that its type more specifically).
Of course it doesn't matter that much, since it's only an exception message, which is there for developers, but lemme take a look around.
from jsonschema.
Yeah, I wasn't sure it was entirely appropriate either. Figured I'd write up the code and see how it works anyway.
from jsonschema.
I'm still thinking about this, but I think you've said enough here -- I'll either merge or politely thank you and pass on the pull request as soon as I've made a decision :). Thanks again.
from jsonschema.
Related Issues (20)
- Unable to resolve a realtive `$ref` from a schema with `$id` pointed to a subschema in `$defs` with `$id` HOT 2
- Self referenced schema encapsulation breaks reference resolution HOT 1
- jsonschema.TypeChecker with additional types fails to work after several reference resolutions by the referencing.Registry HOT 2
- validate fails to identify incorrect uuid strings HOT 3
- 'Tuple' arrays not handled correctly HOT 3
- validate() throwing exception for a valid schema HOT 1
- Draft7Validator(TyperError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry' HOT 2
- Which is the last version not requiring Rust via its dependencies?
- Migrating From RefResolver, unable to resolve $ref
- Feature request: Add support for a second message attribute on errors which is guaranteed not to include the failing instance HOT 5
- Python NaN validates against all numeric limits, and shouldn't HOT 2
- validating nan in an enum is no longer supported HOT 1
- Need a custom ref resolver
- Support custom Registry for meta schema in check_schema HOT 4
- `"format":"date-time"` not working HOT 6
- The latest version is slower than 3.2.0 validator HOT 5
- Validation error messages changed after upgrading jsonschema version from 3.2.0 to 4.21.1 HOT 5
- multipleOf fails to validate that 4.02 is a multiple of 0.01 due to floating point math HOT 1
- Unexpected KeyError while running test suite inside GitLab Worker HOT 3
- Enhancing the multipleOf Validator for Improved Decimal Handling in jsonschema HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonschema.