Skip to content

Add major version level to namespace hierarchy - #208

Merged
EricWittmann merged 4 commits into
mainfrom
major-version-namespace-hierarchy
Mar 27, 2026
Merged

Add major version level to namespace hierarchy#208
EricWittmann merged 4 commits into
mainfrom
major-version-namespace-hierarchy

Conversation

@EricWittmann

Copy link
Copy Markdown
Contributor

Summary

  • Adds a 4th level to the model hierarchy (Common -> Spec -> MajorVersion -> SpecVersion),
    enabling normalization to unify entities/traits within a major version before unifying across
    major versions
  • Adds optional majorVersionPrefix and majorVersionNamespace fields to the
    SpecificationVersion schema and registers them in SpecificationIndex
  • Updates all spec version YAML files with the new namespace structure (e.g.
    asyncapi.v20 becomes asyncapi.v2x.v20)
  • Fixes entity/trait normalization to recursively check descendant namespaces, with
    pass-through parent creation at registered-prefix namespaces when normalization has
    already occurred at a lower level
  • Fixes missing import in CreateWritersStage for regex property common entity types
  • Fixes union method generation (CreateUnionValueMethodsStage) scoping for normalized
    entity properties
  • Adds FullGeneratorTest that runs the generator against the full set of specs (OpenAPI,
    AsyncAPI, JSON Schema, OpenRPC) with compilation validation and golden manifest comparison
  • Bumps project version to 2.0.0-SNAPSHOT

Test plan

  • GeneratorTest passes (simple tests including parent-trait)
  • FullGeneratorTest passes (full spec generation, compilation, manifest)
  • All maven-plugin integration tests pass (mvn verify on maven-plugin-tests)
  • Inspect generated output to verify major version level in package structure

When a union property (e.g. Schema|any) was normalized to a parent entity,
ApplyUnionTypesStage applied the union interface to the common parent entity
interface, but CreateUnionValueMethodsStage only generated method
implementations on the leaf impl in the originating namespace.  This caused
compilation failures for sibling leaf impls that inherited the union interface
but lacked the required methods (e.g. AsyncApi20-26 SchemaImpl missing asAny).

The fix scopes the entity search by the property origin's namespace so that
all leaf impls within the same spec tree receive the union methods.

Also adds FullGeneratorTest which runs all four specs (OpenAPI, AsyncAPI,
JSON Schema, OpenRPC) through the generator with compilation validation.
…SHOT

Introduces a 4th level to the model hierarchy (Common -> Spec -> MajorVersion ->
SpecVersion), allowing normalization to unify entities/traits within a major version
before unifying across major versions. Adds majorVersionPrefix and majorVersionNamespace
optional fields to SpecificationVersion schema. Updates all spec version YAML files
with the new namespace structure. Fixes entity/trait normalization to recursively
check descendant namespaces and propagate parent entities through registered-prefix
namespaces. Fixes missing import in CreateWritersStage for regex property common types.
The maven-plugin module was missing an explicit maven-compiler-plugin
declaration, causing it to fall back to source/target level 5 which
is no longer supported by modern JDKs.
The IT pom.xml files relied on the default maven-compiler-plugin 3.1
which doesn't support the --release option needed for Java 17.
@EricWittmann
EricWittmann merged commit 097d3cd into main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant