example.address
Publish a new version
version 1.0 ▾
- Canonical URL
- https://schematalog.com/api/schemas/example.address/versions/1.0 (opens in a new tab)
- Published
- 22 August 2026 23:11
Properties
| Parameter | Description | Type | Required | Nullable | Default | Example |
|---|---|---|---|---|---|---|
city |
String | Required | ||||
country |
country_code | Required | ||||
kind |
String | Optional | ||||
postcode |
String, Null | Optional | ||||
street |
String | Required |
Definition
{ "type": "object", "$defs": { "country_code": { "type": "string", "pattern": "^[A-Z]{2}$" } }, "$schema": "https://json-schema.org/draft/2020-12/schema", "required": [ "street", "city", "country" ], "properties": { "city": { "type": "string" }, "kind": { "enum": [ "billing", "shipping" ], "type": "string" }, "street": { "type": "string" }, "country": { "$ref": "#/$defs/country_code" }, "postcode": { "type": [ "string", "null" ] } }, "$id": "https://schematalog.com/api/schemas/example.address/versions/1.0", "title": "example.address" }
$defs: country_code: pattern: ^[A-Z]{2}$ type: string $id: https://schematalog.com/api/schemas/example.address/versions/1.0 $schema: https://json-schema.org/draft/2020-12/schema properties: city: type: string country: $ref: '#/$defs/country_code' kind: enum: - billing - shipping type: string postcode: type: - string - 'null' street: type: string required: - street - city - country title: example.address type: object
from __future__ import annotations from enum import Enum from typing import Optional from pydantic import BaseModel, RootModel, constr class Kind(Enum): billing = 'billing' shipping = 'shipping' class CountryCode(RootModel[constr(pattern=r'^[A-Z]{2}$')]): root: constr(pattern=r'^[A-Z]{2}$') class ExampleAddress(BaseModel): city: str kind: Optional[Kind] = None street: str country: CountryCode postcode: Optional[str] = None
{ "type": "record", "name": "ExampleAddress", "fields": [ { "name": "city", "type": "string" }, { "name": "kind", "type": [ "null", { "type": "enum", "name": "Kind", "symbols": [ "billing", "shipping" ], "namespace": "example.address" } ], "default": null }, { "name": "street", "type": "string" }, { "name": "country", "type": "string" }, { "name": "postcode", "type": [ "null", "string" ], "default": null } ], "namespace": "example.address" }