Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-20487

REST API generator issue with typeOut

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.4.0
    • 4.5.0
    • rest
    • None
    • Unknown

    Description

      If REST method typeOut defined then /api-doc throws exception.

      How to reproduce:
      1. rest.camel.yaml

      - restConfiguration:
          component: platform-http
          apiContextPath: /api-doc
          bindingMode: json
      - rest:
          id: rest-b339
          get:
            - id: get-c5d3
              path: /account
              to: direct:get-account
              outType: karavan.simple.Account
              bindingMode: json
      - route:
          id: route-4956
          nodePrefixId: route-7d3
          from:
            id: from-cad7
            uri: direct
            parameters:
              name: get-account
            steps:
              - setBody:
                  id: setBody-0623
                  expression:
                    groovy:
                      id: groovy-782e
                      expression: |-
                        def acc = new karavan.simple.Account()
                        acc.setAccountNumber('12345')
                        acc.setAccountName('test')
                        return acc
              - log:
                  id: log-bd34
                  message: ${body}
      

      2. Java Class

      public class Account {
      
        // Private fields for encapsulation
        private String accountNumber;
        private String accountName;
        private double balance;
      
        public Account() {
        }
      
        public String getAccountNumber() {
          return accountNumber;
        }
      
        public void setAccountNumber(String accountNumber) {
          this.accountNumber = accountNumber;
        }
      
        public String getAccountName() {
          return accountName;
        }
      
        public void setAccountName(String accountName) {
          this.accountName = accountName;
        }
      
        public double getBalance() {
          return balance;
        }
      
        public void setBalance(double balance) {
          this.balance = balance;
        }
      }
      
      

      3. Run

      jbang "-Dcamel.jbang.version=4.4.0" camel@apache/camel run * --gav=karavan:simple:1
      

      4. Call /api-doc

      curl --location 'localhost:8080/api-doc'
      

      5. Get exception:

      2024-02-27 12:46:29.336  WARN 52151 --- [worker-thread-0] agger.v3.core.jackson.ModelResolver : jackson BeanDescription.findJsonValueAccessor not found, this could lead to inaccurate result, please update jackson to 2.9+
      2024-02-27 12:46:29.337  WARN 52151 --- [ntloop-thread-0] ttp.vertx.VertxPlatformHttpConsumer : Failed handling platform-http endpoint /api-doc. Caused by: [java.lang.NoClassDefFoundError - javax/xml/bind/annotation/XmlElement]
      java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
              at io.swagger.v3.core.jackson.SwaggerAnnotationIntrospector.hasRequiredMarker(SwaggerAnnotationIntrospector.java:29) ~[swagger-core-2.2.19.jar:2.2.19]
      

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              marat.gubaidullin@gmail.com Marat Gubaidullin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: