Skip to content
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

Fix custom data implementation #20

Merged
merged 1 commit into from
Sep 8, 2022

Commits on Sep 8, 2022

  1. Fix custom data implementation

    Use a custom unmarshaller and jsonschema tags to fix
    the implementation of custom data.
    
    `CustomData` contains the data as follows:
    
    When the content type is "application/json":
     - if the CDEvent is produced via the golang API, the
       `CustomData` usually holds an un-marshalled golang
       interface{} of some type
     - if the CDEvent is consumed and thus un-marshalled
       from a []byte the `CustomData` holds the data as a
       []byte, so that it may be un-marshalled into a specific
       golang type via the `GetCustomDataAs`
    
    When the content type is anything else:
     - the content data is always stored as []byte, as the
       SDK does not have enough knowledge about the data to
       un-marshal it into a golang type
    
    Extend the interface to include GetCustomDataRaw which
    always returns a []byte.
    
    Extend the test coverage.
    
    Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
    afrittoli committed Sep 8, 2022
    Configuration menu
    Copy the full SHA
    ca9b92b View commit details
    Browse the repository at this point in the history