Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Correct AVRO (.avpr) format #308

Open
angoglez opened this issue Jun 29, 2020 · 1 comment
Open

Correct AVRO (.avpr) format #308

angoglez opened this issue Jun 29, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@angoglez
Copy link
Contributor

Description

It seems the .avpr accepted by compendium it's different from the .avpr "official" format.

EXAMPLE: .avpr accepted currently by compendium (when storing a schema)
(from compendium-example repo)

{
  "type": "record",
  "name": "Supplier",
  "namespace": "higherkindness.compendiumtest",
  "fields": [
    {
        "name": "id_supplier",
        "type": "string"
    }, 
    {
        "name": "name",
        "type": "string"
    },
    {
        "name": "email",
        "type": "string"
    },
    {
        "name": "phone",
        "type": "string"
    }  ]
}

➡️ The .avpr accepted by the plugin sbt-mu-srcgen (that we are now using mixed with the old sbt-compendium)
says to accept another format which is more similar to the one written in the AVRO documentation. This format is not recognized by compendium when trying to store a schema.

EXAMPLE: .avpr accepted by sbt-mu-srcgen
(from mu-scala docs)

{
  "namespace" : "foo",
  "protocol" : "AvroGreeter",
  "types" : [
    {
      "name" : "HelloRequest",
      "type" : "record",
      "fields" : [
        {
          "name" : "arg1",
          "type" : "string"
        },
        {
          "name" : "arg2",
          "type" : [
            "null",
            "string"
          ]
        },
        {
          "name" : "arg3",
          "type" : {
            "type" : "array",
            "items" : "string"
          }
        }
      ]
    },
    {
      "name" : "HelloResponse",
      "type" : "record",
      "fields" : [
        {
          "name" : "arg1",
          "type" : "string"
        },
        {
          "name" : "arg2",
          "type" : [
            "null",
            "string"
          ]
        },
        {
          "name" : "arg3",
          "type" : {
            "type" : "array",
            "items" : "string"
          }
        }
      ]
    }
  ],
  "messages" : {
    "sayHelloAvro" : {
      "request" : [
        {
          "name" : "arg",
          "type" : "HelloRequest"
        }
      ],
      "response" : "HelloResponse"
    }
  }
}

🔗 RELATED DOCUMENT: AVRO PROTOCOL (.avpr) COMPENDIUM/SBT-MU-SRCGEN MISMATCH

@angoglez angoglez added the bug Something isn't working label Jun 29, 2020
@angoglez angoglez changed the title Correct AVRO (.avrp) format Correct AVRO (.avpr) format Jun 29, 2020
@fedefernandez
Copy link
Collaborator

@angoglez I found the problem. The first protocol (the one that mu accepts) includes the types and the services. Inside the types you provide an array of schemas where each one is the type of message accepted by compendium.

So my question is, is this the expected behaviour? I think so, since compendium is for storing types and not the protocol as a whole (types and services).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants