carreraGroup / json-to-avro-schema

Converts JSON schema to AVRO schema
Apache License 2.0
2 stars 1 forks source link

required #5

Closed rubberduck203 closed 3 years ago

rubberduck203 commented 3 years ago

The JSON Schema required keyword is a list of strings that defines properties (fields) that must be present.

If a property is required, the AVRO type for that field can be the simple type.

{
  "type": "record",
  "name": "schema",
  "fields": [
    {
      "name": "title",
      "type": "string"
    }
  ]
}

If it is not required, the AVRO type must be a union of null/type with a default of null.

{
  "type": "record",
  "name": "schema",
  "fields": [
    {
      "name": "title",
      "type": ["null", "string"]
      "default": null
    }
  ]
}
rubberduck203 commented 3 years ago

Depends on #20