jscheam/property

Types

Additional properties configuration for object types

pub type AdditionalProperties {
  AllowAny
  AllowExplicit
  Disallow
  Schema(Type)
}

Constructors

  • AllowAny

    Allow any additional properties (JSON Schema default behavior) This is the default and will omit the additionalProperties field from the schema

  • AllowExplicit

    Explicitly allow any additional properties (outputs “additionalProperties”: true)

  • Disallow

    Disallow any additional properties

  • Schema(Type)

    Additional properties must conform to the specified schema

Constraints that can be applied to properties

pub type Constraint {
  Enum(values: List(json.Json))
  Pattern(regex: String)
}

Constructors

  • Enum(values: List(json.Json))

    Restrict values to a fixed set of values (can be any JSON value)

  • Pattern(regex: String)

    Pattern constraint using regex

A property in a JSON Schema object

pub type Property {
  Property(
    name: String,
    property_type: Type,
    is_required: Bool,
    description: option.Option(String),
    constraints: List(Constraint),
  )
}

Constructors

A JSON Schema type

pub type Type {
  Integer
  String
  Boolean
  Float
  Null
  Object(
    properties: List(Property),
    additional_properties: AdditionalProperties,
  )
  Array(Type)
  Union(List(Type))
}

Constructors

  • Integer
  • String
  • Boolean
  • Float
  • Null
  • Object(
      properties: List(Property),
      additional_properties: AdditionalProperties,
    )
  • Array(Type)
  • Union(List(Type))

    Union type for multiple allowed types (e.g., [“string”, “null”])

Search Document