fix: generate proper json field type according to rfc (#2137)

This commit is contained in:
Elliot DeNolf
2023-02-19 21:31:07 -05:00
committed by GitHub
parent a16bad0cc0
commit 7e8869858c
2 changed files with 58 additions and 16 deletions

View File

@@ -70,7 +70,17 @@ function generateFieldTypes(config: SanitizedConfig, fields: Field[]): {
}
case 'json': {
fieldSchema = { type: 'object' };
// https://www.rfc-editor.org/rfc/rfc7159#section-3
fieldSchema = {
oneOf: [
{ type: 'object' },
{ type: 'array' },
{ type: 'string' },
{ type: 'number' },
{ type: 'boolean' },
{ type: 'null' },
],
};
break;
}