CustomField
A model for defining custom fields on a record.
CustomField
Section titled “CustomField”Property | Type | Required | Description |
---|---|---|---|
name | string | Yes | Name of the custom field |
fieldType | CustomFieldType | Yes | The JSON schema type to use when de-serializing the value |
schema | url | No | Link to the full JSON schema for this custom field |
value | any | Yes | Value of the custom field |
description | string | No | Description of the custom field’s purpose |
Formats
Section titled “Formats”A JSON example of this model.
{ "name": "programArea", "fieldType": "string", "value": "Healthcare Innovation", "description": "Primary focus area of the grant program", "schema": "https://example.com/program-areas.json"}
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: CustomField.yamltype: objectproperties: name: type: string description: Name of the custom field fieldType: $ref: CustomFieldType.yaml description: The JSON schema type to use when de-serializing the `value` field schema: type: string format: uri description: Link to the full JSON schema for this custom field value: description: Value of the custom field description: type: string description: Description of the custom field's purposerequired: - name - fieldType - valueunevaluatedProperties: not: {}examples: - name: eligibilityType fieldType: array value: - nonprofit - academic description: Types of eligible organizations - name: programArea fieldType: string value: Healthcare Innovation description: Primary focus area of the grant program schema: https://example.com/program-areas.jsondescription: A custom field on a model
The TypeSpec code for this model.
@doc("A custom field on a model")model CustomField { /** Name of the custom field */ name: string;
/** The JSON schema type to use when de-serializing the `value` field */ fieldType: CustomFieldType;
/** Link to the full JSON schema for this custom field */ schema?: url;
/** Value of the custom field */ value: unknown;
/** Description of the custom field's purpose */ description?: string;}
The Python code for this model.
class CustomField(CommonGrantsBaseModel): """Represents a custom field with type information and validation schema."""
name: str = Field( ..., description="Name of the custom field", min_length=1, ) field_type: CustomFieldType = Field( ..., alias="fieldType", description="The JSON schema type to use when de-serializing the `value` field", ) schema_url: Optional[HttpUrl] = Field( None, alias="schema", description="Link to the full JSON schema for this custom field", ) value: Any = Field(..., description="Value of the custom field") description: Optional[str] = Field( None, description="Description of the custom field's purpose", )
CustomFieldType
Section titled “CustomFieldType”The set of JSON schema types supported by a custom field.
Options
Section titled “Options”Value | Description |
---|---|
string | Text values |
integer | Whole numbers |
number | Numeric values |
boolean | True/false values |
object | Structured data objects |
array | Lists of values |
Formats
Section titled “Formats”A JSON example of this model.
string
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: CustomFieldType.yamltype: stringenum: - string - number - integer - boolean - object - arraydescription: The set of JSON schema types supported by a custom field
The TypeSpec code for this model.
/** The set of JSON schema types supported by a custom field */enum CustomFieldType { string, number, integer, boolean, object, array,}
The Python code for this model.
class CustomFieldType(StrEnum): """The type of the custom field."""
STRING = "string" NUMBER = "number" INTEGER = "integer" BOOLEAN = "boolean" OBJECT = "object" ARRAY = "array"