Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageyml
titlenew config
schema.locationcontent

If a value for this is not provided, the current behaviour (reading schemas from the message payload) is followed.

If a value is provided, it is will be used as the location on disk of a text file containing a schema.

For example, you could use the config:

Code Block
schemas.enable: true
schema.location: /some/filelocation/schema.json

where /some/filelocation/schema.json contains:

Code Block
{
    content: '{"type": "struct",
    "fields": [
      {
        "field": "id",
        "type": "string",
        "optional": false
      },
      {
        "field": "name",
        "type": "string",
        "optional": false
      }
    ]
  }'

and the Kafka message payload contains:

...

This option will only be used for toConnectData calls. It will be ignored for fromConnectData , this means that this convertor will be explicitly used for sink connector not source connector

Users would be able use ConfigProviders to provide the contents of a file as a schema.

For Example, 

Code Block
schema.content:${directory:/schema/schema.json}

KIP-993: Allow restricting files accessed by File and Directory ConfigProviders will allow users to restrict what files to be used.

Proposed Changes

Functional changes will be made to org.apache.kafka.connect.json.JsonConverter  configure

The configure method will be extended.

If the schema.locationcontent  option is not set, the current behaviour will remain as-is.

If the schema.locationcontent  option is set, the schema file will be read and an instance variable will store the Connect schema to use.

...