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

Cannot add example tag containing double colon (":") #1401

Closed
GusAntoniassi opened this issue Nov 28, 2022 · 0 comments
Closed

Cannot add example tag containing double colon (":") #1401

GusAntoniassi opened this issue Nov 28, 2022 · 0 comments

Comments

@GusAntoniassi
Copy link
Contributor

Describe the bug
The following struct fails to generate the docs through swag init:

type Foo struct {
  Attributes map[string]string `example:"bucket_arn:arn:aws:::foobar-bucket"`
}

The following error is returned:

ParseComment error in file /tmp/foobar/main.go :example value bucket_arn:arn:aws:::foobar-bucket should format: key:value

Escaping the value with double backlashes (\\) does not work.

To Reproduce
Steps to reproduce the behavior:

  1. Create the following main.go file:
package main

type Resource struct {
        Attributes    map[string]string `example:"bucket_arn:arn:aws:::foobar-bucket"`
}

//      @Summary                Foo
//      @Success                200     {object}        Resource
//      @Router                 /foo [get]
func main() {

}
  1. Generate the docs with swag init ./main.go

Expected behavior
Users should be able to create examples with double colons, maybe escaping them with double backlashes to avoid key:value conflicts.

Your swag version
1.8.8

Your go version
e.g. 1.19.3

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Not relevant
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