feat(ui): "Polymorphic" -> "CollectionOrScalar"

This new name more accurately represents that these are fields with a type of `T | T[]`, where the "base" type must be the same on both sides of the union.
This commit is contained in:
psychedelicious
2023-11-29 10:19:51 +11:00
parent 5aaf2e8873
commit 3d4874dc34
14 changed files with 242 additions and 129 deletions

View File

@ -209,7 +209,7 @@ Field types are represented as structured objects:
type FieldType = {
name: string;
isCollection: boolean;
isPolymorphic: boolean;
isCollectionOrScalar: boolean;
};
```
@ -237,11 +237,11 @@ When a field is annotated as a list of a single type, the schema object has an `
We use the item type for field type name, adding `isCollection: true` to the field type.
##### Polymorphic Types
##### Collection or Scalar Types
When a field is annotated as a union of a type and list of that type, the schema object has an `anyOf` property, which holds a list of valid types for the union.
After verifying that the union has two members (a type and list of the same type), we use the type for field type name, adding `isPolymorphic: true` to the field type.
After verifying that the union has two members (a type and list of the same type), we use the type for field type name, adding `isCollectionOrScalar: true` to the field type.
##### Optional Fields