Upgrade to apicurio-unified-model-generator 1.3.0 - #957
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 mapremoveSchema(String name)- remove item from union mapclearSchemas()- clear all itemsgetSchemas()- get the map (getter remains)Removed Methods:
setSchemas(Map)- setter removed, use add/remove/clear insteadThis 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
version.apicurio-unified-model-generator-pluginfrom1.2.14to1.3.0AsyncApi3NodeImporter.java
Updated four locations to use the new
addSchema()method:Before:
After:
Locations Updated:
importNode()- Line 170: Adding imported schema nodesvisitSchema()- Lines 308, 313, 318: Adding standard/Avro/Protobuf schemasimportJson()- Line 419: Adding JSON schemas wrapped in MultiFormatSchemaimportText()- Line 446: Adding text schemas wrapped in MultiFormatSchemaBenefits
Testing
mvn clean compileFiles Changed
pom.xml- Version upgradesrc/main/java/io/apicurio/datamodels/deref/AsyncApi3NodeImporter.java- API updatesStats: 2 files changed, 8 insertions(+), 22 deletions(-)