Skip to content

Conversation

@camille-sound4
Copy link

Describe the PR
When using tags to filter the APIs, it can be handy to filter out some struct fields depending on the tags.

For instance, an administrator may get more information about a customer than a normal user.

This commit adds the swaggerneedtag tag to select a filter tag.

Example:

type Account struct {
    ID   string    `json:"id"`
    Name string     `json:"name"`
    OnlyAdmin int   `json:"onlyadmin" swaggerneedtag:"admin"`
    NotAdmin  int   `json:"notadmin" swaggerneedtag:"!admin"`
}

will include onlyadmin only if --tags contains admin,

and notadmin only if --tags does not contain admin, or contains !admin.

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.

1 participant