Skip to content

Add boolean schemas and raw schema escape hatch #42

Description

@crmne

Goal

Add support for boolean schemas and a raw schema escape hatch.

JSON Schema allows a schema itself to be a boolean:

  • true means every value is valid.
  • false means no value is valid.

Example:

true

accepts anything.

false

rejects everything.

Boolean schemas can also appear inside composition:

{
  "anyOf": [
    true,
    { "type": "string" }
  ]
}

Proposed DSL

any_of :value do
  any_schema
  string
end

none_of :value do
  no_schema
end

Raw escape hatch

raw :value, {
  "type" => "string",
  "const" => "admin"
}

Acceptance criteria

  • Boolean schemas work anywhere subschemas are accepted.
  • Raw schema fragments are preserved and normalized.
  • Generated schemas validate against Draft 2020-12 when fragments are valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions