Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMS - Springwolf generate schemas wrong #1117

Open
pcomp96 opened this issue Dec 3, 2024 · 1 comment
Open

JMS - Springwolf generate schemas wrong #1117

pcomp96 opened this issue Dec 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pcomp96
Copy link

pcomp96 commented Dec 3, 2024

Describe the bug
Hi, Im generating the specification using @AsyncListener and @AsyncPublisher annotations,
when springwolf generate the schemas,
there are some objects specified in the payloadType annotations using generated schema with maven openApi plugin,
where there are some additional fields that not exist like tlDate and tlType.

"tlDate": {}, "tlType": {},

They are showed in the UI and when i download the json i find this fields.

When i try to publish an object i receive a publish failed
image

How i can fix it?

Dependencies and versions used
springboot version 3.3.5
springwolf-ui version 1.9.0
springwolf-core version 1.9.0
springwolf-jms version 1.9.0

Stack trace and error logs
java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.introspect.AnnotatedMember.getDeclaringClass()" because the return value of "com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition.getPrimaryMember()" is null at io.swagger.v3.core.jackson.ModelResolver.isRecordType(ModelResolver.java:1131) at io.swagger.v3.core.jackson.ModelResolver.extractGenericTypeArgumentAnnotations(ModelResolver.java:1109) at io.swagger.v3.core.jackson.ModelResolver.addGenericTypeArgumentAnnotationsForOptionalField(ModelResolver.java:1104) at io.swagger.v3.core.jackson.ModelResolver.resolve(ModelResolver.java:865) at io.github.springwolf.core.asyncapi.schemas.converters.SchemaTitleModelConverter.resolve(SchemaTitleModelConverter.java:23) at org.springdoc.core.converters.WebFluxSupportConverter.resolve(WebFluxSupportConverter.java:86) at org.springdoc.core.converters.AdditionalModelsConverter.resolve(AdditionalModelsConverter.java:155) at org.springdoc.core.converters.FileSupportConverter.resolve(FileSupportConverter.java:69) at org.springdoc.core.converters.ResponseSupportConverter.resolve(ResponseSupportConverter.java:79) at org.springdoc.core.converters.SchemaPropertyDeprecatingConverter.resolve(SchemaPropertyDeprecatingConverter.java:92) at org.springdoc.core.converters.PolymorphicModelConverter.resolve(PolymorphicModelConverter.java:105) at org.springdoc.core.converters.PageableOpenAPIConverter.resolve(PageableOpenAPIConverter.java:93) at org.springdoc.core.converters.PageOpenAPIConverter.resolve(PageOpenAPIConverter.java:92) at org.springdoc.core.converters.SortOpenAPIConverter.resolve(SortOpenAPIConverter.java:83) at io.swagger.v3.core.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:97) at io.swagger.v3.core.converter.ModelConverters.resolveAsResolvedSchema(ModelConverters.java:192) at io.github.springwolf.core.asyncapi.schemas.SwaggerSchemaService.lambda$resolveSchema$1(SwaggerSchemaService.java:83) at io.github.springwolf.core.asyncapi.schemas.SwaggerSchemaService.runWithFqnSetting(SwaggerSchemaService.java:177) at io.github.springwolf.core.asyncapi.schemas.SwaggerSchemaService.resolveSchema(SwaggerSchemaService.java:82) at io.github.springwolf.core.asyncapi.components.DefaultComponentsService.resolvePayloadSchema(DefaultComponentsService.java:33) at io.github.springwolf.core.asyncapi.scanners.common.payload.internal.PayloadService.buildSchema(PayloadService.java:43) at io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadAsyncOperationService.lambda$extractSchema$0(PayloadAsyncOperationService.java:26) at java.base/java.util.Optional.map(Optional.java:260) at io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadAsyncOperationService.extractSchema(PayloadAsyncOperationService.java:26) at io.github.springwolf.core.asyncapi.scanners.common.message.AsyncAnnotationMessageService.buildMessage(AsyncAnnotationMessageService.java:37) at io.github.springwolf.core.asyncapi.scanners.common.channel.AsyncAnnotationChannelService.buildChannel(AsyncAnnotationChannelService.java:54) at io.github.springwolf.core.asyncapi.scanners.channels.annotations.AsyncAnnotationMethodLevelChannelsScanner.mapMethodToChannel(AsyncAnnotationMethodLevelChannelsScanner.java:32) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1921) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1006) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) at io.github.springwolf.core.asyncapi.scanners.channels.annotations.AsyncAnnotationMethodLevelChannelsScanner.scan(AsyncAnnotationMethodLevelChannelsScanner.java:28) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1715) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) at io.github.springwolf.core.asyncapi.scanners.channels.ChannelsInClassScannerAdapter.mapToChannels(ChannelsInClassScannerAdapter.java:34) at io.github.springwolf.core.asyncapi.scanners.channels.ChannelsInClassScannerAdapter.scan(ChannelsInClassScannerAdapter.java:25) at io.github.springwolf.core.asyncapi.channels.DefaultChannelsService.findChannels(DefaultChannelsService.java:34) at io.github.springwolf.core.asyncapi.DefaultAsyncApiService.initAsyncAPI(DefaultAsyncApiService.java:84) at io.github.springwolf.core.asyncapi.DefaultAsyncApiService.getAsyncAPI(DefaultAsyncApiService.java:44) at io.github.springwolf.core.SpringwolfInitApplicationListener.onApplicationEvent(SpringwolfInitApplicationListener.java:31) at io.github.springwolf.core.SpringwolfInitApplicationListener.onApplicationEvent(SpringwolfInitApplicationListener.java:17) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:452) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:385) at org.springframework.boot.context.event.EventPublishingRunListener.ready(EventPublishingRunListener.java:109) at org.springframework.boot.SpringApplicationRunListeners.lambda$ready$6(SpringApplicationRunListeners.java:80) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) at org.springframework.boot.SpringApplicationRunListeners.ready(SpringApplicationRunListeners.java:80) at org.springframework.boot.SpringApplication.run(SpringApplication.java:349)

@pcomp96 pcomp96 added the bug Something isn't working label Dec 3, 2024
@timonback
Copy link
Member

Hi @pcomp96 ,
Thank you for reporting this issue.

There seem to be 2 issues, firstly the scanning of a class and secondly the publishing.
Let's start with the scanning of the class (stacktrace) and tlDate, tlType field.

Can you share the involved classes?
Based on the stacktrace, the class seems to use inheritance either directly or annotated by use of discriminatorMappings.

Having a reproduceable example highly reduces the time to resolution, allows others to participate, and avoids misunderstandings/communications cycles.
You can support by adjusting one of the springwolf examples, so that it reproduces your scenario:

  1. Fork this repo (springwolf-core) and git clone it
  2. Adjust classes, etc in one of the springwolf-examples
  3. Push your local changes to a branch on your fork (git commit, git push)
  4. Open a Pull Request (a notification will appear in your fork as soon as you push your branch), the title should include reproduce and ideally the link to the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants