GithubHelp home page GithubHelp logo

kevinbader / cloudevents-ex Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 3.0 78 KB

Elixir SDK for CloudEvents

Home Page: https://hex.pm/packages/cloudevents

License: Apache License 2.0

Elixir 99.80% Shell 0.20%
cloudevents elixir

cloudevents-ex's People

Contributors

brooksmtownsend avatar fabriziosestito avatar kevinbader avatar mmacai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cloudevents-ex's Issues

Make Avro dependency optional

I'm curious though, would you be fine with me making erlavro an optional dependency in addition to updating it? JSON is required, but we (and likely others) use this library without Avro and that would avoid bringing in extra dependencies (and for what it's worth I think we even got a build failure from one of them that we had to work around)

Originally posted by @brooksmtownsend in #5 (comment)

avro_encode_error when encoding CE with Avro

I have a simple Avro schema for testing

{ "type": "record", "name": "Exampleschema", "fields": [ {"name": "example", "type": "string"} ] }

and starting Cloudevents with

Cloudevents.start_link([{:confluent_schema_registry_url, "http://schema-registry:8081"}, {:avro_schemas_path, "./priv/schemas"}, {:avro_event_schema_name, "Exampleschema"}])

The schema-registry is reachable through docker, and my schema lives in ./priv/schemas/Exampleschema.avsc

I copied over the event from one of your examples to make sure I'm not missing anything

event = Cloudevents.from_map!(%{specversion: "1.0",type: "some-type",source: "some-source",id: "1",data: %{"example" => "bar"}})                            
%Cloudevents.Format.V_1_0.Event{ 
  data: %{"example" => "bar"},
  datacontenttype: "application/json",
  dataschema: nil,
  extensions: %{},
  id: "1",
  source: "some-source",
  specversion: "1.0",
  subject: nil,
  time: nil,
  type: "some-type"
}

when i try to encode it with avro, I get the following

event |> Cloudevents.to_avro                                                                                                                                    
[debug] reading schema `Exampleschema` from the file ./priv/schemas/Exampleschema.avsc
[debug] new schema `Exampleschema` stored with global id `121`
{:error,
 %ErlangError{
   original: {:"$avro_encode_error", :required_field_missed,
    [record: "Exampleschema", field: "example"]}
 }}

but the field is there in the data map.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.