Repository navigation
Releases
v0.13.0
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
v0.12.1
Highlights
-
Keywords beside a message payload's own
$ref, such asrequired, now print a warning, as go-jsonschema warns about keywords beside a$refeverywhere else. They are still ignored. For example:aapi-codegen: warning: schema fidelity: channels.orders.messages.OrderPlaced.payload does not enforce all it declares: required beside $ref not checked -
A payload schema that is itself a
$refto another schema, such as acomponents.schemasentry that only refers to another one, gave code that used a type declared nowhere, so it didn't compile. The generator now stops with an error that says to point the payload's$refat the other schema. A$refto a schema of the same title works as before. -
examples/use-aapi-codegen.sh:AAPI_CACHEis now the cache root, with a directory per version, so a customAAPI_CACHEno longer keeps returning the first version's binary afterAAPI_VERSIONchanges. The default cache path is unchanged. A customAAPI_CACHEthat already ended in the version gets one more level, and one more download. -
Payload types still come from go-jsonschema v0.30.0, and the binaries are built with Go 1.26.11. Every spec in the test suite generates the same code as with v0.12.0.
All changes: v0.12.0...v0.12.1.
Changelog
v0.12.0
Highlights
- Payload types come from go-jsonschema v0.30.0; v0.11.0 used v0.29.0. Generated code checks more of what a payload declares, so it can reject messages that v0.11.0 accepted:
dependentRequired, and the property lists of draft-07'sdependencies: where a property is present, the properties it lists must be too. A schema file that declares its draft gets the keyword that draft defines; one that declares none, like an inline payload, gets both;- a
notofrequired:not: {required: [a, b]}forbids having both; - an
if/then/elsekeyed on one property'sconstorenumchecks each branch keyword by keyword. Before, one branch that couldn't compile whole left the object with no conditional check.
- Keywords beside a
$refare still ignored, but they now print a warning, except in a schema file that declares draft-07 or earlier. Keywords beside a message payload's own$refare still dropped without one. Put them in anallOfbeside the$refinstead. - The release binaries are built with Go 1.26.11, as v0.11.0's were.
- Every spec in the test suite generates the same code as with v0.11.0, except the
validationservicefixture, whose payload gained the new keywords.
All changes: v0.11.0...v0.12.0.
Changelog
v0.11.0
Highlights
- Payload types come from go-jsonschema v0.29.0; v0.10.0 used v0.28.0:
- an
allOfmember thatschema-packagesmaps to another package no longer leaves that package imported and unused, which made the generated file fail to build; unevaluatedProperties: falseis checked, asadditionalProperties: falseis: a key that noallOfmember declares is rejected.
- an
- go-jsonschema's warnings are printed to stderr as
aapi-codegen: warning: …instead of being discarded, for example when the generated code doesn't check a keyword such asminProperties. The file is still written and the exit status is unchanged. Library callers get them throughConfig.Warn. - The release binaries are built with Go 1.26.11, which fixes GO-2026-6859.
- Every existing spec in the test suite generates the same code as with v0.10.0.
All changes: v0.10.0...v0.11.0.
Changelog
v0.10.0
Highlights since v0.9.0
- Fix: a queue name that uses the channel address's parameters but differs from the address, such as
{tenant}.audit-logon{tenant}.orders.created, was generated as the literal"{tenant}.audit-log". It's now built from theSubscribearguments, as the routing key is. A parameter the address lacks stops the generator. - Payload types come from go-jsonschema v0.28.0; v0.9.0 used v0.26.0. Regenerate and review the diff:
format: durationis atypes.Duration, written as ISO 8601 such asPT1H30Mand read from that or from a number of nanoseconds; it was atime.Duration;- a primitive
anyOforoneOfthat lists values keeps its type and is checked; - a required array or object left nil is written as
[]or{}, notnull; - the values inside arrays and maps are checked, and so is
uniqueItems; - integers written as
2.0decode, and aconstproperty gets a constant.
- Three of the test suite's specs change, only in those ways.
All changes: v0.9.0...v0.10.0.
Changelog
v0.10.0-rc.1
Highlights
- Fix: a queue name that uses the channel address's parameters but differs from the address, such as
{tenant}.audit-logon{tenant}.orders.created, was generated as the literal string"{tenant}.audit-log", so the subscriber read from the wrong queue. It's now built from theSubscribearguments, as the routing key is:queueName := tenant + ".audit-log". A typed parameter gets itsstring()conversion. - A queue name that uses a parameter the address doesn't have stops the generator with an error.
- Payload types come from go-jsonschema v0.27.0; v0.9.0 used v0.26.0. Generated code now:
- decodes integers written as
2.0or1e2; - writes a required array or object left nil as
[]or{}, notnull; - checks the values that arrays and maps hold, such as each item's
maxLength, anduniqueItems; - declares a constant for a property's
const, such asOrderPlacedSchemaVersion.
- decodes integers written as
- Three of the test suite's specs change, only in those ways; the others generate byte-identical code to v0.9.0's.
Changelog
v0.9.0
Highlights
- Payload types come from go-jsonschema v0.26.0; v0.8.0 used v0.25.0.
- Generated code can reject messages that v0.8.0 accepted:
- a
oneOfof branches that only listrequiredproperties, such as "email or phone", now requires exactly one of them to be present; - an object's own
if/then/elseis enforced.
- a
deprecated: trueadds a// Deprecated:paragraph to the field's doc comment.- A wrapper for a union of primitive types, such as
oneOf: [boolean, string], gets one constructor per type, such asNewOrderPlacedFlagBool. - The release binaries are built with Go 1.26.10. v0.8.0's were built with Go 1.26.2, which has standard-library vulnerabilities that govulncheck reports as reachable; Go 1.26.10 has none.
go installbuilds with your own toolchain, so use Go 1.26.10 or later. - For every spec in the test suite, the generated code is byte-identical to v0.8.0's.
Changelog
v0.8.0
Highlights since v0.7.0
go install github.com/plheide/aapi-codegen/cmd/aapi-codegen@latestworks. aapi-codegen depends ongithub.com/plheide/go-jsonschemav0.25.0 as a normal module.- Receive operations that share a message type generate code that compiles. Combinations that can't work stop the generator with an error.
- Generated files keep their doc comments and start with
// Code generated by aapi-codegen, DO NOT EDIT. - Payload types follow go-jsonschema v0.25, so regenerate and review the diff. For example:
type: [string, "null"]is*string, not a named pointer type;- a
oneOfof a components$refandnullis a pointer to that type, notinterface{}; - a nullable
enumis a typed enum, not a struct holdinginterface{}; format: int32andformat: int64giveint32andint64, notint;format: dateandformat: timeusegithub.com/plheide/go-jsonschema/pkg/types;- a components array checks its own
minItemsandmaxItems.
All changes: v0.7.0...v0.8.0. The rc.1 to rc.5 release notes describe each step.
Changelog
v0.8.0-rc.5
Highlights
- Payload types come from go-jsonschema v0.25.0-rc.9; rc.4 used rc.8.
- A
oneOfof a components$refandnullis now a pointer to the referenced type, such as*Address, instead ofinterface{}. TheanyOfform already was. - An
anyOfthat mixes an object with a primitive listed first is nowinterface{}. It was the primitive's type, which rejected object values. - A
patternthat Go's regexp can't compile, such as a lookahead, is no longer checked. Its check used to reject every value. - For every spec in the test suite, the generated code is byte-identical to rc.4's.
Changelog
v0.8.0-rc.4
Highlights
- Payload types come from go-jsonschema v0.25.0-rc.8; rc.3 used rc.5.
format: int32andformat: int64still giveint32andint64: go-jsonschema made that mapping opt-in, and aapi-codegen turns it on.- For every spec in the test suite, the generated code is byte-identical to rc.3's.
- Other specs can change, so regenerate and review the diff:
- an inline
oneOfof an object andnullis a pointer to a struct, notinterface{}; - a nullable
enumis a typed enum, such astype Status string, not a struct holdinginterface{}; - a components schema of
type: arraychecks its ownminItemsandmaxItemswhen decoding; - a
defaulton an object property compiles; rc.3 wrote plain values into its pointer fields; - an
anyOfno longer declares unused branch types such asOrderPlacedLines_0.
- an inline
- A
oneOfof a components$refandnullis stillinterface{}.
Changelog
- 4c3c349 ci(deps): bump goreleaser/goreleaser-action
- 6a2a453 build: move to go-jsonschema v0.25.0-rc.8, keeping sized integer formats
- f273560 Merge pull request #11 from plheide/dependabot/github_actions/github-actions-d5b5847ff0
- c69631a Merge pull request #12 from plheide/build/go-jsonschema-rc.8
- 45d7cd8 chore: point the install docs and download script at v0.8.0-rc.4
- 990939c Merge pull request #13 from plheide/chore/release-v0.8.0-rc.4