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

How @Success annotation gets parsed #101

Open
dhudici opened this issue Oct 29, 2015 · 0 comments
Open

How @Success annotation gets parsed #101

dhudici opened this issue Oct 29, 2015 · 0 comments

Comments

@dhudici
Copy link

dhudici commented Oct 29, 2015

I'm running into some odd behavior (at least in relation to what I'm interpreting from the documentation).

I have the following structure and annotation using it for my handler.

type serviceMetrics struct {
    Id               string              `json:"Id"`
    ResponseTime     []map[string]string `json:"ResponseTime"`
    StatusInfo       []map[string]string `json:"StatusInfo"`
    AvailabilityInfo []map[string]string `json:"AvailabilityInfo"`
    ThroughputInfo   []map[string]string `json:"ThroughputInfo"`
}
@Success     200 {object} serviceMetrics

The struct is in the same .go file as the handler for which I have the @Success annotation.
I added the json definition to try to fix the problem but it didn't seem to do anything and I still get the following error when running swagger with or without the definitions.

Can not find definition of []string model. Current package packagename

There is no array of strings present in the struct. What I actually return from the handler is a map[string]serviecMetrics but writing it like that doesn't seem to work since it doesn't recognize map.

@dhudici dhudici changed the title How @Success annotation gets parsed How @Success annotation get parsed Oct 29, 2015
@dhudici dhudici changed the title How @Success annotation get parsed How @Success annotation gets parsed Oct 29, 2015
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

1 participant