Comments (8)
@alyjak @SilverDY 0.5.1 is the fix release! sorry for the delay
from codemirror-json-schema.
Here it is working for the n index of an object definition!
The only missing feature of this parser fix is, the parser only returns an array index pointer if it's an object. so an array like [{ foo: 1 }]
works, but a validation error with foo: [1,2,null]
does not return an array index to match the error that #/foo/2 should be an integer
for example. so yay I've fixed this bug, but found more bugs 😆
from codemirror-json-schema.
do you agree that we should be including each array item in the parsed pointer map? this way, we can target specific array items for errors like these?
Yeah this sounds good to me!
from codemirror-json-schema.
@acao thank you so much for that!
from codemirror-json-schema.
It is not expected behavior. Required properties work in some cases but not all.
to note, @types/json-schema
is a type library, so it is not present at runtime. this is true of any library prefixed with @types or any typescript - when typescript is transpiled for browser compilation with bundlers, all the type annotation and type imports are removed.
the library that takes care of validation logic is json-schema-library
, so we will need to report this bug to them!
our validation tests don't cover everything because it's bad practice to test the features of external libraries in unit testing, and if they fail, there's nothing we can do about it except open a PR to json-schema-library
and ask them to fix the bug. the vast amount of the business logic for our library is autocomplete, however for validation and hover we just provide a thin presentation layer for json-schema-library
results
can you supply an example of the schema that isn't working?
from codemirror-json-schema.
I am facing the same problem.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"properties": {
"ex": {
"type": "number"
},
"in": {
"type": "number"
}
},
"required": [
"ex",
"in"
],
"additionalProperties": false
}
required
doesn't work in any case.
from codemirror-json-schema.
Ok so I took a break from covid to check this out, and you're correct, it is indeed a bug with how we are generating the pointers from json-schema-library
, and thus it is something we should test for!
I hope to have a patch fix released before the weekend
from codemirror-json-schema.
asking my collaborator @imolorhe - do you agree that we should be including each array item in the parsed pointer map? this way, we can target specific array items for errors like these?
update: The answer appears to be yes? I found a way to get the parser to handle this case, but the change breaks the autocomplete because the autocomplete doesn't expect the parser to have these pointers.
Otherwise, it restores error messages for required fields both at the root and in nested/declaration cases, at the cost of autocomplete. This will take a little while!
from codemirror-json-schema.
Related Issues (20)
- simple schema service - pass a single schema service instance to the classes for each lang feature
- basic initial docs
- typedoc markdown
- all codemirror deps should be peer dependencies
- typedoc on release PR only?
- completion insertText for known types
- adopt `json-schema-library` improvements
- Cannot import codemirror-json-schema HOT 7
- Error message: can't find module HOT 32
- Custom value autocompletion HOT 3
- Expected type not working HOT 4
- support complex base types HOT 1
- Console error (json format error) HOT 5
- Module "codemirror-json-schema" has no exported member "handleRefresh"
- YAML support HOT 4
- Add ES modules (ESM) support? HOT 5
- jsonschema rules for array type does not get all applied during validation HOT 1
- Missing License HOT 3
- Module not found - Webpack can't resolve not fully specified paths 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 codemirror-json-schema.