You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be no way of defining a non-null optional field, you get a validation/linting warning when you publish such a schema, but I feel this is perfectly valid.
I had to make lat/lon type ["number", "null"], but this is not valid, I do not want a null value to be passed in at all, in fact I want to a null value to fail validation for this location schema
"location": {
"description": "Place name and lat/Lon coordinates",
"type": ["object", "null"],
"properties": {
"name": {
"description": "The name of this location, city/town etc",
"type": "string",
"maxLength": 2048
},
"lat": {
"description": "Latitude for the location",
"type": ["number", "null"],
"minimum": -90,
"maximum": 90
},
"lon": {
"description": "Longitude for the location",
"type": ["number", "null"],
"minimum": -180,
"maximum": 180
}
},
"required": [
"name"
],
"dependencies": {
"lat": ["lon"],
"lon": ["lat"]
},
"additionalProperties" : false
}
The text was updated successfully, but these errors were encountered:
Hi @edmundadjei, I personally agree with you. I can think of situations where it is helpful to have an optional field, but to disallow explicit nulls.
The Iglu linters provide different levels of message: Info, Warning, and Error. In this case, I think you get a Warning, not an Error. With a Warning, you should be able to still publish the schema, so hopefully this issue hasn't completely blocked you. Please can you confirm that you are technically able to publish your schema, even though it gives you a Warning?
Error messages are slightly different -- if you get an Error then you are disallowed from publishing a schema, and it means your schema is not compatible with the Iglu system.
We probably need a review of which linter level is used for which message type. I am fairly confident that our Error messages are correct, but maybe we could do better at partitioning the Info and Warning messages.
There appears to be no way of defining a non-null optional field, you get a validation/linting warning when you publish such a schema, but I feel this is perfectly valid.
I had to make lat/lon type ["number", "null"], but this is not valid, I do not want a null value to be passed in at all, in fact I want to a null value to fail validation for this location schema
The text was updated successfully, but these errors were encountered: