Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support missing deployedDomain / basePath prefix #42

Open
simdevmon opened this issue Jan 15, 2016 · 3 comments
Open

Support missing deployedDomain / basePath prefix #42

simdevmon opened this issue Jan 15, 2016 · 3 comments

Comments

@simdevmon
Copy link
Contributor

I have an application that is not bound to a single domain, but runs on multiple environments (also locally).

SwaggerUI has the behavior that the current server address and port is used automatically, if the element host is missing in swagger.json.

Therefore it would be useful, if the element host is not generated into swagger.json, if the deployedDomain element is missing, instead of using example.com.

Swagger will automatically use for example http://localhost:8080 or http://192.168.1.2 (hostname / IP, depending on the client).

The problem left is the application name, which is not used. The examples look like this
http://localhost:8080/resources/pet/... but should be
http://localhost:8080/APPLICATION_NAME/resources/pet/...

One possible solution would be to introduce a basePath prefix, which is the application name. So instead of resources it would become application-name/resources.

Edit: moved the issue to the correct project

@rmpestano
Copy link
Contributor

To make it working locally I had to:

  • Change swagger backend to append application root here
  • Put an empty string here when deployedDomain is null or empty.

I can send a PR if you agree.

@sdaschner
Copy link
Owner

You're right, due to the (latest?) Swagger spec it's allowed to leave out the host. I kinda breaks backwards compatibility of our tool, if somebody is relying on the host being there, but I think it's definitely the best way.

Yes of course, please PR :-)

rmpestano pushed a commit to rmpestano/jaxrs-analyzer that referenced this issue Dec 25, 2016
@cristina-brinza
Copy link

Hi,

swagger UI is in my case reachable at the following endpoint (all here are examples) : localhost:12345. All the calls are against localhost:12345/myapi/myversion. However, I don't want to specify a deployedDomain, since I have the application available at different hosts (example.com ; example2.com). The plugin always appends at the moment the project name to the basePath, so swagger tries to make the curl requests agains localhost:12345/APPLICATION_NAME/myapi/myversion, which is not what I would expect.

Could I somehow solve this issue?

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants