latestOpenAPI 3.0.32026-08-109359194.9 KB

112399a67ebb

Data Model Records

Validate From Schema

Requires enable-data-models-feature feature flag. Validate data against a json schema, either by schema definition or schema ID. jsonSchema or schemaId are required parameters.

Authorization Required:

  • Authenticated
post/models/validateFromSchema

Query parameters

validateRequiredFieldsboolean

If false, ignore required fields of a schema and validate the format only

Request body

dataobject required

Data to validate against

draftVersion'draft-06' | 'draft-07' | 'draft-2019-09' | 'draft-2020-12'

JSON Schema draft version. For more information on JSON Schema draft versions - https://json-schema.org/specification-links

jsonSchemaobject

Schema to validate data

schemaIdstring

Schema ID to validate data

Response

Successful

object required

An object with a key of data, with a value that is an object. That object has keys that are the fieldMapping field with the matching data property as the value. If no fieldMapping is passed, then the passed data is returned if no errors are encountered. e.g. Given the data below plus the fieldMapping example -

data: { name1: 'shirt', price1: 1, addProp: 'extra' }

jsonSchema: { title: 'Sample Schema', type: 'object', properties: { name: { type: 'string' }, price: { type: 'number' } }, required: ['name'] }

Response:

{ data: { 'modelId': { name: 'shirt', price: 1 } } }