Properties not defined in JSON schema cause "TypeError"
See original GitHub issueExpected behavior
Properties not defined in JSON schema can be added if it is allowed by the schema.
Actual behavior
Any property added to JSON and not described in JSON schema causes error in console:
TypeError: can't convert null to object
Steps to reproduce the behavior
- Create JSON schema:
{
"type": "object",
"title": "Error: Properties not descibed in schema cause error",
"description": "Create schema for one property, then add another one",
"additionalProperties": true,
"required": ["name"],
"properties": {
"name": {
"type": "string",
"title": "name"
}
}
}
- Load the schema into the JSON Editor, then try to add any property.
- The new property will be successfully added, but there will appear above mentioned error in browser console.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10
Top Results From Across the Web
Json schema validation error - Stack Overflow
Therefore you receive an error about wrong type. JSON schema type MUST be single value or array of such strings: "array","boolean","integer"," ...
Read more >JavaScript TypeErrors and Techniques to Prevent Them
A short guide on best practices, techniques and existing tooling available to prevent TypeErrors in JavaScript or TypeScript.
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
This string has to be valid JSON and will throw this error if incorrect syntax was encountered. Examples. JSON.parse() does not allow trailing...
Read more >API Reference | Ajv JSON schema validator
Properties not defined in the schema will not be included in serialized JSON, unless the schema has additionalProperties: true flag.
Read more >json-schema-library - npm
to prevent some errors when using helper methods with an independent subschema, please use compileSchema if it is not retrieved from a draft- ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
See https://jsfiddle.net/9kcyL7g3/1/ (look at the browser console, too). There is a problem with an option:
remove_empty_properties: true
@pmk65 I have built dist files locally and it works ok. The issue can be closed. Thank you!