skinContractSchema function
Builds the JSON Schema (draft 2020-12) for skin-contract.v1.
Implementation
Map<String, dynamic> skinContractSchema() {
return {
r'$schema': 'https://json-schema.org/draft/2020-12/schema',
'title': 'zuraffa skin contract',
'type': 'object',
'additionalProperties': false,
'required': ['schemaVersion', ...SkinContract.sections.keys],
'properties': {
'schemaVersion': {'const': SkinContract.schemaVersionV1},
for (final entry in SkinContract.sections.entries)
entry.key: {
'type': 'array',
'items': {r'$ref': '#/\$defs/${skinContractDefName(entry.key)}'},
},
},
r'$defs': {
for (final entry in SkinContract.sections.entries)
skinContractDefName(entry.key): _objectSchema(entry.value),
},
};
}