Comments (3)
That's tricky. There was a similar issue with symbol keys causing issues as well. It might be worth validating that all the schema keys are strings. Another option would be allowing schemas to validate themselves against their meta-schema. I was hoping to not have to do that because of how it would impact performance, but I should test how much overhead it actually causes.
Can I ask how you're using the library? You should be able to introduce something like deep_stringify_keys
before passing the schema hash in to get things working how you expect.
from json_schemer.
Can I ask how you're using the library?
We have a tool that lints our OpenAPI spec files and the very first thing it does is to validate the OpenAPI against the schema.
Right now we're using json-schema and it doesn't seem to care about such integer keys, for right or wrong.
I'd rather not having to do any processing to the schema we pass to validate and leave that to the library. Errors are expected and I guess it wouldn't be out of place for json_schemer to raise on such cases. The only thing then is it should raise proper errors so we can rescue them properly.
If not raising is desirable then internally it should rescue everything and return an error without blowing up. I don't know if it's by design but for instance if I pass nil or an empty string right now it doesn't raise.
from json_schemer.
Allow me to close this issue, we figured that we're talking about json schema and by definition the keys are string so this is something we need to handle when processing our input YAML files so they behave the same as JSON files (which is also a valid OpenAPI format).
Thanks!
from json_schemer.
Related Issues (20)
- Validation of date-time HOT 4
- Best way to handle 'nil' values as 'null' in json schema HOT 2
- Lacking support for deprecated fields HOT 1
- Invalid error output with OpenApi 3.1 schema HOT 13
- OpenApi 3.1 schema validator does not handle variables in server urls HOT 4
- Complex json schema appears to leave boxed Schema during token traversal HOT 5
- Option to define custom format validators globally HOT 7
- Unable to reference schema in another folder HOT 2
- `JSONSchemer` is confused about string or symbol keys HOT 6
- Uncaught parse errors during schema validation HOT 3
- For missing parent object the required fields inside this parent object are not part of the error response. HOT 10
- Failure to validate documents against SchemaStore's github-workflow schema HOT 3
- Can't insert property defaults when using definitions HOT 4
- $id of invalid type throws an exception HOT 1
- Drop support for EOL Ruby versions HOT 1
- Some properties with default values not inserted HOT 4
- Undo temporary OpenAPI schema fix HOT 1
- i18n custom error messages are not resolved HOT 3
- Touble parsing key with forward slashes HOT 3
- Validation succeeds when none of the object properties exist HOT 2
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 json_schemer.