Converts Skema schema maps to JSON Schema format.
Pattern Support
Supports both :format and :pattern as aliases for regex pattern constraints.
When both are present, :format takes precedence.
Examples
# Using :format (traditional)
field: [type: :string, format: ~r/^[a-z]+$/]
# Using :pattern (alias)
field: [type: :string, pattern: ~r/^[a-z]+$/]
# Both convert to JSON Schema "pattern" property
%{"type" => "string", "pattern" => "^[a-z]+$"}
Summary
Functions
Converts a Skema field definition (keyword list) to JSON Schema field format.
Converts a Skema field definition (keyword list) to JSON Schema field format with per-field required.
Converts a Skema schema map to JSON Schema properties format.
Converts a Skema schema map to JSON Schema properties format with per-field required.
Functions
Converts a Skema field definition (keyword list) to JSON Schema field format.
Returns a tuple containing:
- JSON field map
- Boolean indicating if field is required
Converts a Skema field definition (keyword list) to JSON Schema field format with per-field required.
Returns JSON field map with required property included if needed.
Converts a Skema schema map to JSON Schema properties format.
Returns a tuple containing:
- Properties map for JSON Schema "properties" field
- Required fields list for JSON Schema "required" field
Converts a Skema schema map to JSON Schema properties format with per-field required.
Returns properties map with required property included in individual fields.