Comments (4)
Is it possible to remove the validation for fields with format = "date" ?
from json-editor.
Sounds tricky...
What's possible is to define string,null
for the property, but this does not exactly do what you want.
{
"title": "json schema example",
"type": "object",
"properties": {
"example": {
"type": [
"string",
"null"
],
"format": "date",
"description": "This is an example schema.",
"default": ""
}
}
}
Or you could use show_opt_in
, but that removes the property completely if not set.
@SamSedivy Do you validate the data on the server also? Is an empty string valid?
@germanbisurgi any ideas? Is it possible to override the validation?
from json-editor.
The problem is that json-editor shouldn't use format
keyword for validation per default. More on that here.
A couple of solutions that came in mind:
With pattern
{
"type": "string",
"description": "Format 'YYYY-MM-DD', or empty.",
"pattern": "^(|\\d{4}-\\d{2}-\\d{2})$"
}
with oneOf
{
"type": "string",
"description": "Format 'YYYY-MM-DD', or empty.",
"oneOf": [
{
"title": "Date Format",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
{
"title": "Empty String",
"pattern": "^$"
}
]
}
from json-editor.
This has bitten me as well.
Previously, this schema has worked fine:
schema={
"type": "object",
"properties": {
"title": {"type": "string"},
"issues": {
"type": "array",
"format": "table",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"number": {
"type": "string",
},
"published_on": {
"type": "string",
"format": "date",
},
},
},
},
},
}
Now it already fails when initializing the editor for a new object. Changing minItems
to zero allows the initialization to proceed. The oneOf
thing isn't an option really since an empty string isn't valid but there's no way to even enter any data. The exact error is t.errmsg is undefined
in the addInputError
handler, but I'm not sure if that helps.
EDIT: The big problem is that the initialization fails and the je-not-loaded
isn't removed; pointer-events:none
makes it impossible to select the fields to start adding valid data.
from json-editor.
Related Issues (20)
- Hidden fields with dependencies disappear after setValue() HOT 1
- [question]How can i hide false ouput value on checkbox. HOT 2
- [question] How to get updated schema from json-editor after adding object field HOT 10
- Can I Do Dependencies Only On the Default Value And Enum? HOT 1
- [bug]select2 setValue report a error and not select it HOT 8
- Starrating format isn't working properly HOT 1
- bug/regression: bool or number value does not show when remove_empty_properties=true and use_default_values=false
- Can Do a "WACTH" To Another Root "JSON Editor". HOT 4
- Auto generate schema for simple cases HOT 5
- Support for chained / nested watch HOT 2
- Add meta-data (schema builder) example HOT 1
- Validation of datetime-local fails when oneOf is used HOT 3
- An error occurs when a dependency is defined after the field that depends on it HOT 1
- Dependent field does not update when watched field changes HOT 1
- Failure to parse schema with "default": null due to unhandled exception in browser console
- select2 doesn't refer enumSource of item in array. HOT 12
- How do I add my syntax highlighting to Ace Editor? HOT 1
- test
- Enum wont be selected on load if it not the first element HOT 2
- Dependencies with false values not fullfilled 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 json-editor.