fix: handle null schemaType in assignType for composed schemas - #1835
Open
itsmib wants to merge 1 commit into
Open
fix: handle null schemaType in assignType for composed schemas#1835itsmib wants to merge 1 commit into
itsmib wants to merge 1 commit into
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.
Open
4 tasks
Member
|
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? |
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.
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