Don't use AJV. Use JSON.
See original GitHub issueThis SDK uses a library called AJV for schema validation. However, it makes creating and using CloudEvent objects very complicated through a set of setters and getters.
It would be a lot simpler to be able to directly create CloudEvent objects given a JSON object. Further field validation could be done externally through a different function rather than a ajv.compile(schema)
and external spec
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Frequently Asked Questions - Ajv JSON schema validator
Why Ajv validates empty object as valid? "properties" keyword does not require the presence of any properties, you need to use "required" keyword....
Read more >Security considerations - Ajv JSON schema validator
Regardless the measures you take, using untrusted schemas increases security risks. # Circular references in JavaScript objects. Ajv does not support schemas ...
Read more >Why use AJV - Ajv JSON schema validator
Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. Currently Ajv is the fastest and...
Read more >Ajv options - Ajv JSON schema validator
Usage. This page describes properties of the options object that can be passed to Ajv constructor. For example, to report all validation errors...
Read more >Choosing schema language - Ajv JSON schema validator
# Choosing schema language · Ajv supports the new specification focussed on defining cross-platform types of JSON messages/payloads - JSON Type Definition (JTD)....
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 Free
Top 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
I don’t have any particular love or hate for AJV. But do you have another suggested tool for schema validation? AJV gets 31 million downloads a week, so I think it’s probably pretty well liked.
Yeah, the usage now is a lot cleaner than it was before. It does take 60% of the bundle size, so I was a little concerned if we’re trying to slim this package down. Maybe it could an optional dependency in the future.
Should be fine to keep until there’s a better suggestion.