The type each neutral type of a field gives
Each neutral type a field may have gives, in a file of runtime checks and in a file of types, the values of a field of type one of being those of its own list and those the lists of domains declare for it, in the order the specification reads:
| Field's type | JSON Schema | TypeScript | Python |
|---|---|---|---|
| text | {"type": "string"} |
string |
str |
| email address | {"type": "string", "format": "email"} |
string |
str |
| whole number | {"type": "integer"}, with its bounds |
number |
int |
| number | {"type": "number"}, with its bounds |
number |
float |
| yes/no | {"type": "boolean"} |
boolean |
bool |
| instant | {"type": "string", "format": "date-time"} |
string |
str |
| date | {"type": "string", "format": "date"} |
string |
str |
| duration | {"type": "string", "format": "duration"} |
string |
str |
| any value | {} |
unknown |
Any |
| one of | {"enum": [<its values>]} |
the union of its values as literals | Literal[<its values>] |
| list of | {"type": "array", "items": <its members' type>}, with its bounds on how many members it holds |
<its members' type>[] |
list[<its members' type>] |
| map of | {"type": "object", "additionalProperties": <its values' type>} |
Record<string, <its values' type>> |
dict[str, <its values' type>] |
| record | {"$ref": "#/$defs/<its type's name>"} |
its type's name | its type's name, as a string |
| identifier of | what the field identifying that data record gives | what that field gives | what that field gives |
| variant | an object holding its fields | an object holding its fields | its own type |
JSON Schema is the standard every language has a validator for, and the bounds on a number's value and on how many members a field of type list of holds are already named in the nodes as JSON Schema names them. Each language's own type for a value is the one its code reads without a conversion: an instant, a date and a duration travel as text, each in the form of ISO 8601 its format names. A bound is carried by the runtime checks alone, which run alike in every language; a type in Python can state none. An identifier has the type of the field that identifies the data record it names, so that a value moving from that field to a field referring to it keeps its type and passes the same check.
The links it makes
The decisions taken on it
- Problem
Nothing said what type an identifier of a data record has: text, as JSON:API requires of every identifier, or whatever the identified data record makes it from.
- Ruling
The owner: an identifier has the type of the field that identifies the data record it names, which that data record's node names, so that the type comes from the specification and the link from the identifier to that field can be checked.
- Problem
A field holding a day of the calendar had no neutral type but text, or an instant, which adds a time of day and an offset the day does not have; as text, two spellings of one day passed as two days, and a check of the spelling would have been written beside the data record. And the table gave no place to a bound on how many members a field of type list of holds.
- Ruling
The owner: a neutral type date is added, a day of the calendar with no time of day and no time zone, checked by the
dateformat of JSON Schema; a field of type list of takes bounds on how many members it holds, named as JSON Schema names them.
The tests bound to it
- skills/tools/test/unit/types.test.ts · s-4npdup7mjkva69y bounds how many members a list holds in the runtime checks alone
- skills/tools/test/unit/types.test.ts · s-4npdup7mjkva69y gives a field of type one of the values the lists of domains declare for it, in the order the specification reads
- skills/tools/test/unit/types.test.ts · s-4npdup7mjkva69y gives an identifier the type of the field identifying the data record it names
- skills/tools/test/unit/types.test.ts · s-4npdup7mjkva69y gives each neutral type the type its table names, in each language