schema.field.format.md

January 18, 2023 ยท View on GitHub

Home > @datashaper/schema > Field > format

Field.format property

Describes the semantic or parsing format for the values. This is based on JSONSchema. See https://json-schema.org/draft/2020-12/json-schema-validation.html\#name-vocabularies-for-semantic-c TODO: JSONSchema is pretty flexible here, and we should align with it. For example, there are standard string (uri, email, ip-address, etc.) that define known formats. However, you can also link out to any arbitrary schema that validates a data value. JSONSchema also uses the format field to describe date and time notation. Because dates are not a valid JSON type, they are represented as type = string, but format = date, time, date-time, or duration. We use the type in running code, so it seems appropriate to keep the expanded list, but maybe this can contain parsing instructions (e.g., a pattern) for converting date/time strings into values. https://json-schema.org/draft/2020-12/json-schema-validation.html\#name-defined-formats

Signature:

format?: string;