Comments (7)
Hi @fcmdeveloper1 ,
Can you share the classes that are involved, again so that we can easily reproduce it?
Or are those the same as in #729 ?
An alternative to uploading the code as zip is to fork the repo, create a new branch, edit the example (https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-kafka-example/src/main/java/io/github/springwolf/examples/kafka/dtos/ExamplePayloadDto.java ; no need to fix tests or anything like that) and commit&push + open a pr to the repo (or your fork)
from springwolf-core.
Dear @timonback,
yes, exact project, you can reproduce the issue, also, you can see the behavior if you omit the "allOf" and "discriminatorProperty" from the LearningEvent object which is the desired setup to match the swagger default behavior, the eventKey property will not appear in the object.
please, let me know if i can help or support.
My Best Regards
from springwolf-core.
Hi @fcmdeveloper1,
I started looking into and created #745 so that we can look at the same thing together.
The code contains two variations - see the commits in the pr
- The discriminator field
eventKey
is added as own field in the Parent class LearningEvent
has the@Schema#allOf
property set
- Variation 1 works out of the box for me, although requires code changes in your event class.
- Variation 2 produces already the correct spec document, however springwolf-ui cannot handle the anyOf schemas yet. The required changes are included in the PR and you can verify that in the preview deployment.
for swagger, without adding the allOf and discriminatorProperty attributes, everything is working perfectly, which is the expected behavior for both UI and the generated swagger description.
I debugged the output of swagger-parser (which springwolf uses) (excluding the extra field of variation 1, excluding the property in the schema annotation of variation 1). Then 3 fields (eventKey is missing) show up.
What do you mean with swagger? springdoc and its ui?
from springwolf-core.
Dear @timonback,
i think i was not clear enough, if you omit the allOf and discriminatoProperty from the LearningEvent object, the fields of the parent will not be rendered or will be ignored (you can try yourself) although the object itself clearly extends the ParentObject, that's why i got confused, because, i expect to have all the fields including the eventKey without writing the allOf or the discriminatoProperty attributes, and this is what happens in swagger. with or without these attributes, the UI and properties are rendered perfectly.
also, i didn't get well what do you mean by code changes for variation1.
and for the swagger, yes, i am using springdoc-openapi-ui for the swagger documentation.
My Best Regards
from springwolf-core.
Hi @fcmdeveloper1
Lets break it down.
I agree that swagger does not add the field eventKey from the annotations to any object. That might be expected behaviour as the class does not have the field. The field is only used during deserialization and therefore part of the payload, but not within the application.
Therefore, I suggested the alternatives (variations). Both are shown in the reproduce PR in separate commits: d6690f9
Do the alternatives work for you? Or can you investigate what we need to change in springwolf?
from springwolf-core.
Dear @timonback,
thanks for your suggestions, and this is my comments for both options and i am not sure if it is doable or the changes are huge:
- The discriminator field eventKey is added as own field in the Parent class
i guess this will be difficult and may be misleading to the developers which might at the end lead to having 2 eventKey properties, one from the deserialization and the other from the added class property, which i guess is not best match. - LearningEvent has the @Schema#allOf property set
i guess this is more suitable especially after you support the allOf for the UI itself, however, it might be more friendly to the developer who is usually using the swagger if you added the same properties from the parent object which is already extended from the object. and i guess we agreed the eventKey is a deserialized property which will appear in all cases.
we can have further discussions if any.
thanks a lot
My Best Regards
from springwolf-core.
We discussed, but we do not see another way at this point - besides the 2 offered options.
The library swagger-parser
that we use already omits the eventKey field, so Springwolf does not see it either.
You are welcome to suggest a code improvement via a PR.
Apart from that, one improvement regarding the rendering in springwolf-ui
has been made that will be part of the next release.
from springwolf-core.
Related Issues (20)
- Configurable URL in Springwolf UI HOT 9
- StackOverflow during initialization HOT 10
- @AsyncOperation.Headers.Header#value is mandatory and renders as "enum" HOT 7
- TypeToClassConverter is unable to handle types `? extends <other>` HOT 3
- Allow for declaration of multiple co-existing AsyncAPIs HOT 3
- Easier control over quotes / always quote string values in YAML? HOT 11
- Build example for schema: error with SpringWolf 1.4.0, but working fine with 1.2.0 HOT 6
- java.lang.StackOverflowError: null in 1.4.0 release HOT 2
- [Enhancement request] SpringWolf to be compatible with Reactor Kafka HOT 6
- Schema introspection of Map<String,Foo> HOT 7
- AsyncListener/AsyncPublisher supports ElementType.TYPE HOT 5
- Upgrade issues from 1.2.0 to 1.4.0 Reactive HOT 3
- 📍 META: Redesign `springwolf-ui`: Feedback, Discussion & Participation HOT 4
- Support for @KafkaListener beanRef HOT 2
- Support @Hidden annotation to hide certain eventhandlers/listeners HOT 6
- Support for a polymorphic payload HOT 11
- springwolf-amqp-example fails HOT 3
- Header definitions are overriding others HOT 4
- Error creating entityManagerFactory - NullPointerException in Hibernate during application startup with Java 17 and Spring Boot 3.3.2 HOT 5
- Cannot use @Header annotation with method parameters. UnsupportedOperationException: SchemaObjectMerger.merge is trying to put on immutable properties map. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from springwolf-core.