question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to remove 'host' field from generated docs?

See original GitHub issue

Springfox version: 3.0.0-SNAPSHOT.

The response of my /v2/api-docs looks like this:

{
  "swagger": "2.0",
  "host": "localhost:8888",
  "basePath": "/"
}

But I want to remove the host field. This would allow to use “Try it out” from /swagger-ui.html relative to the current host. The swagger reference (Omitting host and scheme) says, that it’s allowed. So resulting JSON would look like this:

{
  "swagger": "2.0",
  "basePath": "/"
}

I found no way to do this in the springfox configuration. I tried to set Docket.host(null), but in this case, it will use default empty-string value. I’m using SNAPSHOT version, but it wouldn’t work in stable versions too.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ClaudenirFreitascommented, Mar 27, 2020

it is possible to use:

-Dspringfox.documentation.swagger.v2.host=

2reactions
dilipkrishcommented, Jun 25, 2020

@ClaudenirFreitas thanks for that

Read more comments on GitHub >

github_iconTop Results From Across the Web

About default fields (host, source, sourcetype, and more)
About default fields (host, source, sourcetype, and more). When Splunk software indexes data, it tags each event with a number of fields.
Read more >
Protect your domain with a TXT record - Google Help
Switch to the tab with your registrar's web site and create a new TXT record. · Enter @ in the Name field. This...
Read more >
Exploring data in Looker | Google Cloud
Click the selected field in the field picker or click Remove from the column's gear menu. Click Run to re-run the query. You...
Read more >
URL removal explained, Part I: URLs and directories
To request removal of a directory or site, click on the site in question, then go to Site configuration > Crawler access >...
Read more >
About documentation - dbt Developer Hub
dbt provides a way to generate documentation for your dbt project ... a DAG of your project, any tests you've added to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found