Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-2880

Problems enabling swagger doc with custom endpoint in spring boot

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • 7.7.0.GA
    • Kie-Server
    • RHPAM 7.7.0.GA + Springboot

    • Hide

      Taking this as an example:

      ~~~
      http://localhost:8090/rest/history/example
      ~~~

      1. Clone the git repo
      ~~~
      $ git clone https://github.com/agiertli/realtime-jms-audit-replication.git
      ~~~
      2. Checkout 'fix-swagger' branch
      ~~~
      $ cd realtime-jms-audit-replication
      $ git checkout fix-swagger
      ~~~
      3. Go to "realtime-jms-audit-replication/kjar" deploy
      ~~~
      $ mvn clean install
      ~~~
      4. Go to "realtime-jms-audit-replication/spring-boot-kie-server" run
      ~~~
      $ mvn spring-boot:run -Dspring-boot.run.profiles=local
      ~~~

      When you call

      ~~~
      $ curl --user anton:password1! http://localhost:8090/rest/swagger.json
      ~~~

      instead of actual swagger doc, you receive an example response, see:

      ~~~
      {
      "swagger": "2.0",
      "info": {
      "description": "The Application",
      "version": "1.0.0",
      "title": "Sample REST Application",
      "contact":

      { "name": "users@cxf.apache.org" }

      ,
      "license":

      { "name": "Apache 2.0 License", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }

      },
      "basePath": "/rest"
      }
      ~~~

      If the cxf.jaxrs.classes-scan and cxf.jaxrs.classes-scan-packages properties from properties file are commented, then the swagger doc is generated, however the custom endpoint no longer works and the generated swagger doc does not contain our endpoint.

      If you need credentials, you can use any of these:

      ~~~
      user / user -> roles: kie-server
      wbadmin / wbadmin -> roles: admin
      kieserver / kieserver1! -> roles: kie-server
      anton / password1! -> roles: kie-server,admin,rest-all
      ~~~

      Show
      Taking this as an example: ~~~ http://localhost:8090/rest/history/example ~~~ 1. Clone the git repo ~~~ $ git clone https://github.com/agiertli/realtime-jms-audit-replication.git ~~~ 2. Checkout 'fix-swagger' branch ~~~ $ cd realtime-jms-audit-replication $ git checkout fix-swagger ~~~ 3. Go to "realtime-jms-audit-replication/kjar" deploy ~~~ $ mvn clean install ~~~ 4. Go to "realtime-jms-audit-replication/spring-boot-kie-server" run ~~~ $ mvn spring-boot:run -Dspring-boot.run.profiles=local ~~~ When you call ~~~ $ curl --user anton:password1! http://localhost:8090/rest/swagger.json ~~~ instead of actual swagger doc, you receive an example response, see: ~~~ { "swagger": "2.0", "info": { "description": "The Application", "version": "1.0.0", "title": "Sample REST Application", "contact": { "name": "users@cxf.apache.org" } , "license": { "name": "Apache 2.0 License", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, "basePath": "/rest" } ~~~ If the cxf.jaxrs.classes-scan and cxf.jaxrs.classes-scan-packages properties from properties file are commented, then the swagger doc is generated, however the custom endpoint no longer works and the generated swagger doc does not contain our endpoint. If you need credentials, you can use any of these: ~~~ user / user -> roles: kie-server wbadmin / wbadmin -> roles: admin kieserver / kieserver1! -> roles: kie-server anton / password1! -> roles: kie-server,admin,rest-all ~~~
    • 2020 Week 16-18 (from Apr 13)

      We are trying to enable swagger doc in the spring-boot-kie-server app (generated from start.jbpm.org). We want to use a custom endpoint which we would like to be added into the generated swagger doc as well. Here is the guide we are following [1]. You can follow the "Steps to reproduce" section.

      • How to add a custom endpoint to spring boot app (as per jbpm documentation)?
      • How can the custom endpoint be added to the generated swagger doc? So the final swagger doc should include complete kie-server rest api plus the custom rest api.

      [1] https://docs.jboss.org/jbpm/release/7.31.0.Final/jbpm-docs/html_single/#__businessappstutorials

            elguardian@gmail.com Enrique González Martínez (Inactive)
            rhn-support-omolinab Oscar Molina
            Karel Suta Karel Suta
            Karel Suta Karel Suta
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: