Hello Jiri,

did you tried the solution I proposed?

Marco

Il Mar 24 Set 2024, 11:16 <[email protected]> ha scritto:

> Hello again,
>
> I performed some deeper investigation comparing the two projects
>
> 1. The generate classes Coorder.java are identical in both projects
> (except for timestamp)
> 2. Pom.xml are almost identical (except for parent)
> 3. Put on /api/v3/pet results in proper binding to Pet class in both
> projects
> 4. Put on /api/rest/gop/v1/coorder is properly is properly binded to
> Coorder class in the examples project while to LinkedHashMap on de demo
> project.
> 5. Same Camel version 4.8.0
>
> I would be very grateful if anyone can tell me what makdes the difference.
>
> Regards
>
> Jiri
>
> ______________________________________________________________
> > Od: [email protected]
> > Komu: [email protected]
> > Datum: 20.09.2024 12:26
> > Předmět: Re: [QUESTION] Open API Rest DSL - bindingPackageScan
> >
> >Hi Claus,
> >
> >i did a lot of investigations but i did not find the cause.
> >
> >I have forked the example repository and added the api specification
> >
> https://github.com/jirmed/camel-spring-boot-examples/tree/open-api-coorder/openapi-contract-first
> >I have tested in the debugger and the class Coorder is binded correctly
> >
> >Then i create another project from scratch but copying as much as
> possible from the examples
> >
> https://github.com/jirmed/camel-spring-boot-examples/tree/open-api-coorder/openapi-contract-first
> >
> >I think it is almost identical to the one in the examples repository
> except for the parent pom and package names. But if I test it in the
> original route direct:updatePet the JSON is properly binded to Pet class
> while in the new direct:putCoorder route the JSON is binded as
> java.util.LinkedHashMap.
> >
> >I am completely out of ideas what makes the difference
> >
> >Regards
> >
> >Jiri
> >
> >______________________________________________________________
> >> Od: "Claus Ibsen" <[email protected]>
> >> Komu: [email protected]
> >> Datum: 19.09.2024 17:19
> >> Předmět: Re: [QUESTION] Open API Rest DSL - bindingPackageScan
> >>
> >>Hi
> >>
> >>Without looking into this, but you could have both projects and then
> >>compare the generated classes if there is some difference. The package
> >>scanner is there to detect clases by annotations / name etc.
> >>
> >>
> >>On Thu, Sep 19, 2024 at 5:02 PM <[email protected]> wrote:
> >>
> >>> Hello community,
> >>>
> >>> i try to use OpenAPI wing bindingPackageScan to map the request to a
> POJO
> >>>
> >>> my route definition looks like following:
> >>>
> >>>         restConfiguration()
> >>>             .bindingMode(RestBindingMode.json)
> >>>             .bindingPackageScan("cz.bvv.integrationservices.model");
> >>>
> >>>         rest()
> >>>             .openApi()
> >>>
>  .specification("/openapi/gop/sender/camelGOP-openapi-v1.json")
> >>>             .missingOperation("ignore");
> >>>
> >>> except for the names it is identical with the example on
> >>>
> https://github.com/apache/camel-spring-boot-examples/blob/main/openapi-contract-first/src/main/java/sample/petstore/PetStoreRoute.java
> >>>
> >>> the definition part in my OpenAPI looks like:
> >>>
> >>>     "/coorder": {
> >>>       "put": {
> >>>         "tags": [
> >>>           "coorder"
> >>>         ],
> >>>         "summary": "Create or modify Coorder",
> >>>         "operationId": "putCoorder",
> >>>         "requestBody": {
> >>>           "description": "Coorder list",
> >>>           "content": {
> >>>             "application/json": {
> >>>               "schema": {
> >>>                 "$ref": "#/components/schemas/Coorder"
> >>>               }
> >>>             }
> >>>           },
> >>>           "required": true
> >>>         }
> >>>         ]
> >>>       }
> >>>     }
> >>>
> >>>
> >>> This is the generator definition in pom.xml
> >>>
> >>>             <plugin>
> >>>                 <groupId>io.swagger.codegen.v3</groupId>
> >>>                 <artifactId>swagger-codegen-maven-plugin</artifactId>
> >>>                 <version>3.0.52</version>
> >>>                 <executions>
> >>>                     <execution>
> >>>                         <goals>
> >>>                             <goal>generate</goal>
> >>>                         </goals>
> >>>                         <configuration>
> >>>                             <!-- we only want to generate the model
> >>> classes for spring boot -->
> >>>                             <language>spring</language>
> >>>                             <library>spring-boot3</library>
> >>>
> >>>
> <inputSpec>${project.basedir}/src/main/resources/openapi/gop/sender/camelGOP-openapi-v1.json</inputSpec>
> >>>
> >>> <modelPackage>cz.bvv.integrationservices.model</modelPackage>
> >>>                             <generateApis>false</generateApis>
> >>>
> >>> <generateApiDocumentation>false</generateApiDocumentation>
> >>>
> >>> <generateModelDocumentation>false</generateModelDocumentation>
> >>>                             <generateApiTests>false</generateApiTests>
> >>>
>  <generateModelTests>false</generateModelTests>
> >>>
> >>> <generateSupportingFiles>false</generateSupportingFiles>
> >>>                             <generateModels>true</generateModels>
> >>>                         </configuration>
> >>>                     </execution>
> >>>                 </executions>
> >>>             </plugin>
> >>>
> >>> it is also (except for the filename and package) copied from the
> example.
> >>>
> >>> But if i debug any inbound message it gets mapped to
> >>> java.util.LinkedHashMap instead of my
> >>> cz.bvv.integrationservices.model.Coorder class.
> >>>
> >>> I tried to build and debug the example project but it maps the request
> >>> JSON correctly to Pet class.
> >>>
> >>> Trying both on version 4.8.0
> >>>
> >>> Can anyone suggest what can be the problem?
> >>>
> >>> Regards
> >>>
> >>> Jiri
> >>>
> >>
> >>
> >>--
> >>Claus Ibsen
> >>-----------------
> >>@davsclaus
> >>Camel in Action 2: https://www.manning.com/ibsen2
> >>
> >>
> >
> >
>

Reply via email to