microprofile-extensions / openapi-ext

Some extensions for MicroProfile OpenAPI
Apache License 2.0
22 stars 13 forks source link

How to set host name? #30

Open rsoika opened 4 years ago

rsoika commented 4 years ago

I am running the openapi-ext in Payara-micro on Docker. This works fine, but the server box shows only the internal docker host name:

image

How can I overwrite or add the external hostname (e.g. localhost) I read that it is possible to configure swagger ui with the microprofile config api, but I did not found an example how the config parameter have to look like.

I tried something like this in my docker-compose file:

  training-service:
    image: imixs/imixs-ml-training-service
    environment:
      OPENAPI-UI_COPYRIGHTBY: "Ralph"

But it did not work. Also I found no information how the server configuration variable should be named.

rsoika commented 4 years ago

I finally figured it out and I wrote a short blog about it: https://ralph.blog.imixs.com/2020/05/08/microprofile-openapi-and-swagger-ui/

phillip-kruger commented 4 years ago

Nice blog. Only one thing, you are still using the old artifact I'd, see https://github.com/microprofile-extensions/openapi-ext/tree/master/openapi-ui#getting-started, rather use openapi-ui

phillip-kruger commented 4 years ago

openapi_ui_copyrightBy should work as a key in env car in docker

rsoika commented 4 years ago

Thanks a lot for the hint - this all is very great work!

But now (maybe) I found something strange?

In my test environment I am running payara/micro:5.194 and also payara/micro:5.201.

With version 1.1.3 it works fine using the following dependecy:

        <dependency>
            <groupId>org.microprofile-ext.openapi-ext</groupId>
            <artifactId>openapi-ui</artifactId>
            <version>1.1.3</version>
        </dependency>

But with the latest version 1.1.4 I see the following exception

Caused by: java.lang.reflect.InvocationTargetException
.....
training-service_1  | Caused by: java.lang.NoSuchMethodError: java.io.InputStream.readAllBytes()[B
training-service_1  |   at org.microprofileext.openapi.swaggerui.Templates.getLogo(Templates.java:121)
training-service_1  |   at org.microprofileext.openapi.swaggerui.Templates.afterCreate(Templates.java:46)
training-service_1  |   ... 70 more

are you aware of this? I will try to see if I can find a reason....

phillip-kruger commented 4 years ago

Yea I think it might be jdk 11 specific

phillip-kruger commented 4 years ago

So I need a fix for jdk 8, or branch

rsoika commented 4 years ago

Yes it is the jdk 10/11. I did not get my own maven projects working with jdk 10. I am still building all my project on jdk 1.8. I do not understand why this is such a big problem with maven and the compiler plugin. Which maven version are you using for dev? Maybe I should upgrade my maven...

phillip-kruger commented 4 years ago

I am using the latest maven, and jdk 11. But I do like to still support 8 as well so I'll look for a fix

rsoika commented 4 years ago

ok great!