Skip to content

support for passing basepath as an argument #2713

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

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

svyotov
Copy link
Contributor

@svyotov svyotov commented Feb 13, 2022

Not all projects use as a base path /, and this limitations makes generation of projects with go-swagger difficult to maintain.
Please consider this proposal as a solution to the issue described above.

  • This is an extension and it is backwards compatible, does not break old way of work, extends it.

Possibly related to #1083

@svyotov svyotov force-pushed the support-for-passing-base-path branch from 11c4b7b to a83c774 Compare February 13, 2022 16:46
Signed-off-by: Stanislav Yotov <29090864+svyotov@users.noreply.github.com>
@svyotov svyotov force-pushed the support-for-passing-base-path branch from a83c774 to b3e7136 Compare February 13, 2022 20:51
@codecov
Copy link

codecov bot commented Feb 13, 2022

Codecov Report

Merging #2713 (b3e7136) into master (22d2f27) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2713   +/-   ##
=======================================
  Coverage   82.91%   82.91%           
=======================================
  Files          55       55           
  Lines        9548     9548           
=======================================
  Hits         7917     7917           
  Misses       1117     1117           
  Partials      514      514           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22d2f27...b3e7136. Read the comment docs.

@youyuanwu
Copy link
Member

If you follow https://swagger.io/docs/specification/2-0/api-host-and-base-path/ and specify base path in your spec, the generated Default base path should use the one in the spec. This new CLI option added by you is a override of the base path in spec.

@svyotov
Copy link
Contributor Author

svyotov commented Feb 13, 2022

If you follow https://swagger.io/docs/specification/2-0/api-host-and-base-path/ and specify base path in your spec, the generated Default base path should use the one in the spec. This new CLI option added by you is a override of the base path in spec.

Yes, because in some cases the base path is dynamic, it is not hardcoded. This PR still keeps the old behavior, but allows overrides when needed - for servers for example ran behind a load balancer someone might need to provide a custom base path to get the deployment done cleanly.

@casualjim casualjim merged commit 1dc6bd5 into go-swagger:master Feb 14, 2022
@casualjim
Copy link
Member

Thanks for not changing existing behavior

@svyotov svyotov deleted the support-for-passing-base-path branch February 14, 2022 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants