Can I split an Apache Avro schema across multiple files?

前端 未结 6 1481
青春惊慌失措
青春惊慌失措 2020-12-24 12:43

I can do,

{
    \"type\": \"record\",
    \"name\": \"Foo\",
    \"fields\": [
        {\"name\": \"bar\", \"type\": {
            \"type\": \"record\",
             


        
6条回答
  •  一整个雨季
    2020-12-24 13:07

    You can also define multiple schemas inside of one file:

    schemas.avsc:

    [
    {
        "type": "record",
        "name": "Bar",
        "fields": [ ]
    },
    {
        "type": "record",
        "name": "Foo",
        "fields": [
            {"name": "bar", "type": "Bar"}
        ]
    }
    ]
    

    If you want to reuse the schemas in multiple places this is not super nice but it improves readability and maintainability a lot in my opinion.

提交回复
热议问题