openapi-ext icon indicating copy to clipboard operation
openapi-ext copied to clipboard

How to set host name?

Open rsoika opened this issue 5 years ago • 9 comments

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 avatar May 08 '20 15:05 rsoika

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/

rsoika avatar May 08 '20 16:05 rsoika

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 avatar May 08 '20 16:05 phillip-kruger

openapi_ui_copyrightBy should work as a key in env car in docker

phillip-kruger avatar May 08 '20 17:05 phillip-kruger

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....

rsoika avatar May 08 '20 20:05 rsoika

Yea I think it might be jdk 11 specific

phillip-kruger avatar May 08 '20 20:05 phillip-kruger

So I need a fix for jdk 8, or branch

phillip-kruger avatar May 08 '20 20:05 phillip-kruger

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...

rsoika avatar May 08 '20 20:05 rsoika

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

phillip-kruger avatar May 08 '20 21:05 phillip-kruger

ok great!

rsoika avatar May 08 '20 21:05 rsoika