Skip to content

fix: refactor AspectModelAsyncApiGenerator to use AspectModelJsonSchemaVisitor + minor fixes#934

Open
andreas-wirth wants to merge 1 commit intoeclipse-esmf:mainfrom
bci-oss:928-fix-asyncapi-schema-generation
Open

fix: refactor AspectModelAsyncApiGenerator to use AspectModelJsonSchemaVisitor + minor fixes#934
andreas-wirth wants to merge 1 commit intoeclipse-esmf:mainfrom
bci-oss:928-fix-asyncapi-schema-generation

Conversation

@andreas-wirth
Copy link
Copy Markdown
Contributor

Description

  • refactor AspectModelAsyncApiGenerator to use AspectModelJsonSchemaVisitor to generate schema for asyncapi
  • extend tests

Fixes #928

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
    No docs needed IMO
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Additional notes:

Add any other notes or comments here.

}
aspect.getOperations().forEach( operation -> {
operation.getInput().forEach( input ->
addOperation( operationsNode, aspect.getName(), input.getName(), ACTION_RECEIVE ) );
Copy link
Copy Markdown
Contributor Author

@andreas-wirth andreas-wirth Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generates an Operation for each input, which is not desirable. Instead, generate only one Operation with an object wrapping all inputs. Also consider adding suffixes to the generated messages like "Request" and "Response"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for noticing this, Andreas.

I added a question with example for this case, in related ticket, but now I see that you have mentioned it here.

Just to confirm - you are right that when we have an Operation with 1 or more inputs, all of these should be handled under 1 AsyncAPI Operation as inputs.

Having multiple AsyncAPI operations for each individual input in the Aspect Model Operation is wrong because, in the model we would have defined specific Operation, which takes number of input parameters, that correspond to specific case or are required to be able to provide the declared in the aspect model operation response.
However, splitting the inputs in standalone AsyncAPI operations will break this set up, because it will provide # number of possible AsyncAPI calls that would be expected to return same response, which will be impossible due to the missing other input parameters.

With regards to the "Request" and "Response" - this would be very handy for better readability and understanding of the generated AsyncAPI, when one is going through it.

Thanks again and I hope that this would also be addressed in this fix :)

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.

[BUG] Payload in generated AsyncAPI does not match specified in the model dataType

2 participants