-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support dynamic data content type #471
support dynamic data content type #471
Conversation
0372101
to
15a7e3c
Compare
Signed-off-by: Isaac Aymerich <[email protected]>
15a7e3c
to
d34b27f
Compare
Makes sense. Likely a change we should do in the go sdk too to support |
Just maybe rename |
Signed-off-by: Isaac Aymerich <[email protected]>
Signed-off-by: Isaac Aymerich <[email protected]>
updated |
@@ -43,7 +44,10 @@ public final class JsonFormat implements EventFormat { | |||
* Content type associated with the JSON event format | |||
*/ | |||
public static final String CONTENT_TYPE = "application/cloudevents+json"; | |||
|
|||
/** | |||
* Suppoted Content type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if it's good to call it "Supported Content type".
Other content type should work too, they will just be exposed as byte[]
not objects IIRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, any suggestion for the naming?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something along the lines of "JSON Data Content Type Discriminator" - long-winded I know ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JemDay Done!
While we're changing this test-case could we also enhance it to ensure that the 'datacontenttype' in the deserialized event matches the 'contentType' that was used to construct the original event (from your test argument list) Just an extra level of sanity checking. |
Signed-off-by: Isaac Aymerich <[email protected]>
Done! |
Thanks LGTM.... |
/cc @pierDipi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @segator, LGTM
Now checks if `datacontenttype` matches the regex: `^(application|text)\/([a-zA-Z]+\+)?json$")` This regex support `application/foobar+json` or standard ``` application/json text/json ``` Signed-off-by: Isaac Aymerich <[email protected]> Signed-off-by: alex-butcher <[email protected]>
Fixes #470
Now checks if dataContentType matches the next regex.
^(application|text)\/([a-zA-Z]+\+)?json$")
This regex support
application/foobar+json
or standard