fix: handle null schemaType in assignType for composed schemas - #1835
Conversation
…posed schemas Set.of() rejects null values, causing an NPE when a composed schema (allOf/oneOf/anyOf) has no explicit type. Added null check before calling Set.of(schemaType). Also improved warning log messages in DefaultChannelsService and DefaultOperationsService to show exception class name when message is null, making startup errors easier to diagnose. Fixes springwolf#1834
✅ Deploy Preview for springwolf-ui canceled.
|
There was a problem hiding this comment.
Welcome to Springwolf. Thanks a lot for creating your first pull request. Please check out our contributors guide and feel free to join us on discord.
|
Hi @itsmib, I am not sure about the benefit of logging the name of the exception, in case the message of the exception is null. The exception including stacktrace is logged anyway and part of the log. For this PR, can you revert the logging changes? |
e8a51dc to
63b693e
Compare
|
Hey @timonback, Thanks for the review. Logging changes are reverted now. |
Problem
SwaggerSchemaMapper.assignTypecallsSet.of(schemaType)when theswagger Schema has a null type.
Set.ofrejects null, causing an NPEfor any property whose schema is a composed schema (allOf/oneOf/anyOf)
which legitimately carries no type.
This silently drops channels/operations from the published AsyncAPI
document, the only signal being a WARN log with
nullas the message.Changes
assignTypebefore callingSet.of(schemaType)DefaultChannelsServiceandDefaultOperationsServiceto show exception class name whengetMessage()returns nullTest
Added
mapNullTypeForComposedSchematest inSwaggerSchemaMapperTestto verify no NPE is thrown for schemas with null type.
Fixes #1834