Skip to content

Upgrade to apicurio-unified-model-generator 1.3.0 - #957

Merged
EricWittmann merged 1 commit into
mainfrom
upgrade-code-generator-1.3.0
Jan 13, 2026
Merged

Upgrade to apicurio-unified-model-generator 1.3.0#957
EricWittmann merged 1 commit into
mainfrom
upgrade-code-generator-1.3.0

Conversation

@EricWittmann

Copy link
Copy Markdown
Contributor

Summary

This PR upgrades the apicurio-unified-model-generator plugin from version 1.2.14 to 1.3.0 and updates code to work with the new collection manipulation API for union maps and lists.

Code Generator Changes

Version 1.3.0 of the code generator (PR #196) introduces a consistent API for union collections:

New Methods Generated:

  • addSchema(String name, MultiFormatSchemaStandardSchemaUnion value) - add item to union map
  • removeSchema(String name) - remove item from union map
  • clearSchemas() - clear all items
  • getSchemas() - get the map (getter remains)

Removed Methods:

  • setSchemas(Map) - setter removed, use add/remove/clear instead

This aligns union maps/lists with the same manipulation patterns as entity maps/lists, providing a more consistent and intuitive API.

Changes in This PR

pom.xml

  • Upgraded version.apicurio-unified-model-generator-plugin from 1.2.14 to 1.3.0

AsyncApi3NodeImporter.java

Updated four locations to use the new addSchema() method:

Before:

if (components.getSchemas() == null) {
    components.setSchemas(new java.util.LinkedHashMap<>());
}
components.getSchemas().put(name, value);

After:

components.addSchema(name, value);

Locations Updated:

  1. importNode() - Line 170: Adding imported schema nodes
  2. visitSchema() - Lines 308, 313, 318: Adding standard/Avro/Protobuf schemas
  3. importJson() - Line 419: Adding JSON schemas wrapped in MultiFormatSchema
  4. importText() - Line 446: Adding text schemas wrapped in MultiFormatSchema

Benefits

  1. Simpler Code: No need for null checks or manual map initialization
  2. Consistent API: Union collections now match entity collection patterns
  3. Type Safety: Methods are strongly typed for the specific collection
  4. Cleaner Diffs: 14 fewer lines of code

Testing

  • Build compiles successfully: mvn clean compile
  • Ready for full test suite execution

Files Changed

  • pom.xml - Version upgrade
  • src/main/java/io/apicurio/datamodels/deref/AsyncApi3NodeImporter.java - API updates

Stats: 2 files changed, 8 insertions(+), 22 deletions(-)

Updated to code generator version 1.3.0 which introduces collection
manipulation methods for union maps and union lists.

Key changes:
- Upgraded apicurio-unified-model-generator-plugin from 1.2.14 to 1.3.0
- Updated AsyncApi3NodeImporter to use new addSchema() method instead of
  setSchemas() + getSchemas().put() pattern
- The new API automatically handles map initialization, eliminating null checks
- Four locations updated: importNode(), visitSchema(), importJson(), importText()

The new code generator provides a consistent API across all collection types
with methods like addSchema(), removeSchema(), clearSchemas(), which align
with entity map/list manipulation patterns.

Fixes compilation errors introduced by the code generator upgrade.
@EricWittmann
EricWittmann merged commit 35e9bdb into main Jan 13, 2026
1 check passed
@EricWittmann
EricWittmann deleted the upgrade-code-generator-1.3.0 branch June 26, 2026 14:59
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