Sometimes in a data source, the key will be unknown. For example, the name.nativeName field in the data from this API has a a key of a language. That key is an abbreviation for a language, and we cant anticipate what that key will be.
How can we handle this? We still want the data to have structure, as in, we know the keys within that field are official and common, so it's not entirely unstructured, and it'd be a shame if we lose all structure within because of this. We need a generic here.
Maybe:
{
name: {
schema: {
type: "object",
object_schema: {
nativeName: {
schema: {
type: "object",
object_schema: {
"<<generic>>": {
schema: {
type: "object",
field_name_enum: languagesArr
object_schema: {
official: {
schema: {
type: "string"
}
},
common: {
schema: {
type: "string"
}
}
}
}
}
}
}
}
}
}
}
}
This is a possible mapping. We do two novel things here:
<<generic>> - use our variables pattern to symbolize a dynamic field here
field_name_enum - a new schema property to let us know the possible options for the field's name
Sometimes in a data source, the key will be unknown. For example, the
name.nativeNamefield in the data from this API has a a key of a language. That key is an abbreviation for a language, and we cant anticipate what that key will be.How can we handle this? We still want the data to have structure, as in, we know the keys within that field are
officialandcommon, so it's not entirely unstructured, and it'd be a shame if we lose all structure within because of this. We need a generic here.Maybe:
This is a possible mapping. We do two novel things here:
<<generic>>- use our variables pattern to symbolize a dynamic field herefield_name_enum- a new schema property to let us know the possible options for the field's name