How to write the schema to dynamically add values ...
# help-connector-development
a
How to write the schema to dynamically add values if it's expected that an object can have more than one properties? I want to write the schema file for below snippet
Copy code
"merge_fields": {
        "property1": null,
        "property2": null
      },
k
A message from kapa.ai
To create a schema that allows for additional properties in an object, you can use the
additionalProperties
field in your JSON schema. Here's an example schema for your
merge_fields
object:
Copy code
json {   "$schema": "<http://json-schema.org/draft-07/schema#>",   "type": "object",   "properties": {     "merge_fields": {       "type": "object",       "properties": {         "property1": {           "type": ["null", "string"]         },         "property2": {           "type": ["null", "string"]         }       },       "additionalProperties": true     }   } }
In this schema, the
merge_fields
object has two properties,
property1
and
property2
, which can be either
null
or
string
. The
additionalProperties: true
field allows for any additional properties to be added to the
merge_fields
object dynamically. For more information on handling additional properties in Airbyte, you can refer to the [Json to Avro Conversion documentation](https://docs.airbyte.com/understanding-airbyte/json-avro-conversion#additional-properties).