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.

Should throw if specversion attribute is missing

See original GitHub issue

Describe 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

  1. Receiver.accept({ 'Content-Type': 'application/cloudevents+json' }, { id: 'foo', source: 'foo', type: 'foo' });
  2. Prints console.error saying it will fallback to 1.0
  3. Validation passes

Expected Behavior It should throw, since the specversion attribute is missing

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
lholmquistcommented, Oct 7, 2020

@lance that sounds good. i’ll take of it

1reaction
lancecommented, Sep 3, 2020

The other required attribute that we supply a default for if it’s not provided is id. The same would happen for this.

Read more comments on GitHub >

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

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