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

swag init with --instanceName generates invalid variable #1133

Closed
Syuparn opened this issue Feb 10, 2022 · 2 comments
Closed

swag init with --instanceName generates invalid variable #1133

Syuparn opened this issue Feb 10, 2022 · 2 comments

Comments

@Syuparn
Copy link
Contributor

Syuparn commented Feb 10, 2022

Describe the bug
A clear and concise description of what the bug is.

When swag init is executed with --instanceName, it generates invalid variable and compile error is raised

To Reproduce

Steps to reproduce the behavior:

  1. clone this repository
  2. run swag init --instanceName foo in sample project example/basic/

Expected behavior

swag generates variable SwaggerInfo_foo .

Screenshots
If applicable, add screenshots to help explain your problem.

Complie error is raised because SwaggerInfo variable is split into 2 tokens as below

// SwaggerInfo_foo holds exported Swagger Info so clients can modify it
var SwaggerInfo _foo = &swag.Spec{
	Version:          "1.0",
	Host:             "petstore.swagger.io",
	BasePath:         "/v2",
	Schemes:          []string{},
	Title:            "Swagger Example API",
	Description:      "This is a sample server Petstore server.",
	InfoInstanceName: "foo",
	SwaggerTemplate:  docTemplate_foo,
}

Your swag version
e.g. v1.7.9-p1

Your go version
e.g. 1.17.6

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
@ubogdan
Copy link
Contributor

ubogdan commented Feb 23, 2022

I believe this can be closed since it was released with v1.8.0.

@Syuparn
Copy link
Contributor Author

Syuparn commented Feb 24, 2022

I tried swag init --instanceName foo in v1.8.0 and it generates a valid variable var SwaggerInfofoo. Thank you so much!

@Syuparn Syuparn closed this as completed Feb 24, 2022
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

2 participants