Should throw if specversion attribute is missing
See original GitHub issueDescribe the Bug
Does not throw if event doesn’t have a specversion
attribute, and fallbacks to 1.0
. The spec says that the specversion
attribute is mandatory, so I think this library should fail when it’s missing, instead of “magically” falling back.
Steps to Reproduce
Receiver.accept({ 'Content-Type': 'application/cloudevents+json' }, { id: 'foo', source: 'foo', type: 'foo' });
- Prints
console.error
saying it will fallback to1.0
- Validation passes
Expected Behavior
It should throw, since the specversion
attribute is missing
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
How to throw error properly for a missing property? [duplicate]
You can throw a completely custom Error. function ModuleNotFoundError(message) { this.name = "ModuleNotFound"; this.message = message ...
Read more >cloudevents.exceptions.MissingRequiredFields Example
Minimally expects the attributes 'type' and 'source'. If not given the attributes 'specversion', 'id' or 'time', this will create those attributes with ...
Read more >org.apache.felix.scrplugin.helper.Validator.logError java code ...
Validate the service and its interfaces * If errors occur a message is added to the issues list, * warnings can be added...
Read more >Getting started | tsoa - GitHub Pages
We set the specVersion to 3 so tsoa will generate an OpenAPI v3 specification. For a full list of all the possible config,...
Read more >org.apache.tools.ant.taskdefs.optional.extension.Specification ...
The class is part of the package ➦ Group: org.apache.ant ➦ Artifact: ant ... static final String MISSING = "Missing "; /** *...
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
@lance that sounds good. i’ll take of it
The other required attribute that we supply a default for if it’s not provided is
id
. The same would happen for this.