Skip to content

v0.32.0

Latest

Choose a tag to compare

@github-actions github-actions released this 25 Nov 18:51
· 7 commits to main since this release
c99a245

The fork's eighth stable release, from the same commit as v0.32.0-rc.1.

Compared with v0.31.0, an anyOf or oneOf of listed strings becomes one enum, a oneOf of objects that $refs name is tried variant by variant, any number of packages that another run writes can be left unwritten, and unevaluatedProperties is checked beside branches that evaluate no property. The README lists every difference from upstream.

  • An anyOf or oneOf whose branches only list strings, with const or enum, inline or through a $ref, is an enum of the strings it admits: those that a branch of the anyOf lists, and those that just one branch of the oneOf lists. Before, such an anyOf was interface{}, unchecked, and such a oneOf was reported as not compiled. A branch that admits only null makes the field a pointer. A conditional that narrows a property through a $ref to such an enum is checked as one that narrows it with an inline enum is.
  • A oneOf of objects that $refs name, with no const to tell them apart, gets a holder that tries each variant, as one of inline objects did; so does one with a variant built with an allOf. Before, it was interface{}, reported as not compiled. A variant closed with unevaluatedProperties: false counts as closed. A oneOf with a variant whose not, if/then/else or dependentSchemas its type cannot check is left as it was, since a valid value could decode as two variants: this now holds for inline variants too, which were tried before.
  • --schema-output URI=, with no file name, writes nothing for the schema: its types are in a package that another run writes, and the files that refer to them import it. Any number of packages can be left so; a second one failed before. Both runs must name the package's types alike, which they do when they generate the same schemas into it in the same order.
  • Under --strict-additional-properties, unevaluatedProperties: false is checked beside an anyOf, oneOf, conditional or dependentSchemas whose subschemas evaluate no property, such as branches that only list required, and beside a not.
  • A discriminated oneOf of $refs in a 2019-09 or later document no longer warns that each variant has other keywords beside its $ref.

New rejections, with default flags: a string that an enum union does not list; an object that matches no variant, or more than one, of a oneOf of $ref'd objects; a narrowed property outside the enum that its $ref names. Under --strict-additional-properties, also a property that an object closed with unevaluatedProperties: false does not declare, beside the keywords above.

Changed types: fields that were interface{} become enums or holders. An anyOf of an enum and a map or array of it takes its first typed branch's type, as before; where the enum was an untyped oneOf of consts, that was the container, and now it is the enum. A oneOf whose inline variant has a not that its type cannot check is interface{} instead of a holder.

Built with Go 1.26.11, and checked with govulncheck before it was published.

Changelog

  • b8ff985 Merge pull request #82 from plheide/docs/readme-image-tag-v031
  • c99a245 Merge pull request #83 from plheide/fix/v032-unions-and-ref-variants
  • a5d8310 docs(fork): name v0.31.0 in the container image example
  • e44f9f9 feat(enum-union): generate an anyOf or oneOf of listed strings as one enum
  • 614ed1f fix(cross-tree): write nothing for any number of unwritten packages
  • 9aee09c fix(enum-union): keep a type of string beside the union from admitting null
  • 84b933f fix(oneof): keep a closed variant's shape to the properties it evaluates
  • e56248c fix(oneof): stop at an allOf that leads back to itself
  • 9b58cfd fix(oneof): try each variant of a oneOf of objects that $refs name
  • d06dd42 fix(unevaluated): check unevaluatedProperties beside branches that evaluate none
  • c8a12bd test(unevaluated): say that the presence-keyed conditional stays unchecked