Skip to content

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 10 Oct 17:15
· 10 commits to master since this release
  • Initial release: schema-as-code combinators with three ports wired to one
    definition — parse() (runtime validation with structured error paths,
    rendered as $.tags[2] and RFC 6901 /tags/2), arbitrary()
    (a rasuvaeff/property-testing-core generator over the exact same value
    set) and toJsonSchema() (a pure draft 2020-12 fragment through
    JsonSchemaExport). The parity between the ports is the package's law,
    pinned by its own property suite over random schema trees: generated
    values parse (source domain), and their wire projection validates against
    the export through opis (wire domain).
  • Types: string (code-point length bounds, full-match pattern, named
    formats email/uuid/uri/date-time/ipv4), int (bounds), bool,
    literal, enum (backed; accepts an instance or the backed value,
    returns the instance), json (the json_decode domain), arrayOf
    (list, count bounds), mapOf (string keys, count bounds), object
    (required/optional/default properties, additionalProperties), union
    (first success wins), nullable, lazy (recursive shapes, factory
    memoized).
  • Combinators: transform (target-space generation, source-space shrinking,
    optional inverse for round-trip laws, optional wire PHP→JSON converter
    and jsonSchema codec — strict export throws without a codec, the
    declared codec is checked against the generator's actual output),
    refine (post-condition; filtered generation; exports as an honest
    superset plus a NonRepresentable entry).
  • Object semantics: an absent optional key is absent from the result (not
    null); default() implies optional(), is validated against the schema
    at construction and stored normalized (an enum default may be given as
    its backed value). The default JSON Schema annotation goes through the
    wire seam. Error messages never embed input values — kinds and sizes
    only.
  • regex() accepts the Gen::stringMatching convention (no delimiters)
    and eagerly probes generatability: a pattern the generator cannot
    compile is an authoring error at construction, not an explosion in
    arbitrary().