Skip to content

v0.13.0

Latest

Choose a tag to compare

@github-actions github-actions released this 25 Nov 21:39
124e9c1

Highlights

  • AsyncAPI 3.x parameter enums. A channel parameter's own enum now makes it a Go type, as schema.enum did. schema is the AsyncAPI 2.x form, which asyncapi validate rejects in a 3.x document, so valid 3.x specs used to get a plain string. The names are unchanged: jobType with enum: [build, deploy] gives type JobType string with JobTypeBuild and JobTypeDeploy. Regenerate: parameters with an enum change from string to the enum type in the Send and Subscribe signatures.
  • Pattern parameters the 3.x way. x-aapi-codegen: {pattern: '…'} on a parameter gives the pattern type, with NewX and MustX. A parameter's schema is still read, with a warning that names the 3.x form. A parameter that declares its own enum or x-aapi-codegen.pattern ignores its schema, and the warning says so.
  • Checked parameter values. Enum and pattern types get a Valid() method, and an enum a <Type>Values() function that lists its values. Since a conversion such as JobType("x") compiles, every Send and Subscribe method checks its typed parameters first. A value outside its type returns an error, such as parameter jobType: "x" is not a valid JobType, and nothing is published or bound. With omit-validation, nothing is checked.
  • go-jsonschema v0.32.0 (v0.12.1 used v0.30.0). An anyOf or oneOf of listed strings becomes an enum, and a oneOf of $ref'd objects decodes variant by variant; both were interface{}. unevaluatedProperties: false is also checked beside branches that evaluate no property. Since v0.31.0, a schema-packages alias of main or documentation is refused.
  • The binaries are built with Go 1.26.11, as before. Specs without typed parameters generate the same code as with v0.12.1.

All changes: v0.12.1...v0.13.0.

Changelog

  • 5e965b2 Merge pull request #23 from plheide/dependabot/github_actions/github-actions-8aadb2d7d5
  • 124e9c1 Merge pull request #24 from plheide/feat/v0.13.0-typed-parameters
  • b41a421 build: move to go-jsonschema v0.32.0
  • e6d7aa6 ci(deps): bump actions/setup-go
  • f1ea5ac feat: check typed parameters in Send and Subscribe
  • 4fad9e6 feat: take a parameter's pattern from x-aapi-codegen, warn about schema
  • 7fe8bd3 feat: type a channel parameter from its AsyncAPI 3.x enum
  • 66c0f89 fix: let a parameter's own enum or pattern win over its schema