Repository navigation
Highlights
- AsyncAPI 3.x parameter enums. A channel parameter's own
enumnow makes it a Go type, asschema.enumdid.schemais the AsyncAPI 2.x form, whichasyncapi validaterejects in a 3.x document, so valid 3.x specs used to get a plainstring. The names are unchanged:jobTypewithenum: [build, deploy]givestype JobType stringwithJobTypeBuildandJobTypeDeploy. Regenerate: parameters with anenumchange fromstringto the enum type in theSendandSubscribesignatures. - Pattern parameters the 3.x way.
x-aapi-codegen: {pattern: '…'}on a parameter gives the pattern type, withNewXandMustX. A parameter'sschemais still read, with a warning that names the 3.x form. A parameter that declares its ownenumorx-aapi-codegen.patternignores itsschema, 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 asJobType("x")compiles, everySendandSubscribemethod checks its typed parameters first. A value outside its type returns an error, such asparameter jobType: "x" is not a valid JobType, and nothing is published or bound. Withomit-validation, nothing is checked. - go-jsonschema v0.32.0 (v0.12.1 used v0.30.0). An
anyOforoneOfof listed strings becomes an enum, and aoneOfof$ref'd objects decodes variant by variant; both wereinterface{}.unevaluatedProperties: falseis also checked beside branches that evaluate no property. Since v0.31.0, aschema-packagesalias ofmainordocumentationis 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