question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't use AJV. Use JSON.

See original GitHub issue

This 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:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
lancecommented, May 1, 2020

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.

0reactions
grantcommented, May 29, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found