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

Ability to set "schemes" programatically #433

Closed
dskoda1 opened this issue Jul 2, 2019 · 5 comments
Closed

Ability to set "schemes" programatically #433

dskoda1 opened this issue Jul 2, 2019 · 5 comments

Comments

@dskoda1
Copy link

dskoda1 commented Jul 2, 2019

Is your feature request related to a problem? Please describe.

A service i'm working on requires scheme to be http for local development, and preferably only https once its deployed. If the schemes could be controlled programatically, this would be possible!

Currently I can only set schemes to https http to make this work; and its a lose lose, because locally, I need to switch it to http to get requests working, and when deployed, http is still an option even though I don't want it to be one.

Describe the solution you'd like

Add an option to the SwaggerInfo struct created in #220 to set the scheme.

Describe alternatives you've considered

Open to other options people might think of.

@dskoda1
Copy link
Author

dskoda1 commented Jul 2, 2019

I'm happy to take a stab at this by the way!

@easonlin404
Copy link
Member

PR is welcome 👍

@dskoda1
Copy link
Author

dskoda1 commented Jul 5, 2019

So it looks like all the other configurations which can be set programmatically are being set in a template, within a template - gen.go. The intermediate template variables are being set in the parser. These are being set on the SwaggerProps struct of upstream go-openapi/spec repository.

Unfortunately I can't figure out a way to set up a template representation of the array of schemes in the second link (parser) such that it can be stored in the SwaggerProps.Schemes property, since its a slice of strings, not just a string like the other variables.

Definitely a bit of a roadblock, any ideas on how this could be worked around? Possibly an option is to make use of the VendorExtensible aspect of the spec.Swagger type, however i'm not very familiar with how that works.

@ubogdan
Copy link
Contributor

ubogdan commented Jul 7, 2019

I've just created a PR for this. Good luck!

@easonlin404
Copy link
Member

fix via #438

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

No branches or pull requests

3 participants