Hi @gerhardo,
I checked with the main developer of the java-spring-cloud-steam-template for asyncapi and it currently does not consider the optional/required as part of the generated POJOs. He did open an enhancement for the template in the template repo here to get it on the to do list. Feel free to contribute if you’d like of course
While the AsyncAPI Code Generator does not yet support it, according to the Spring Cloud Stream Reference guide you can register a org.springframework.validation.Validator
and then use the @Valid annotation as part of the method signature to ensure that your ingoing/outgoing objects are valid. To me that seems like it would be the best route to take. They don’t have much info in the docs but if you use this link and search for “@Valid” it’s easy to find. Let me know what you come up with as I haven’t had the chance to test this out myself yet!
-Marc