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

add support for querying flags by description, enabled and with limit #126

Merged
merged 2 commits into from
Jun 11, 2018
Merged

Conversation

amalfra
Copy link
Contributor

@amalfra amalfra commented Jun 6, 2018

Description

This PR adds support for querying flags by description and enabled status; also adds support for limiting number of results returned using limit query parameter

Motivation and Context

#100 - the flags endpoint currently does not support filtering and limiting results. this seems to be useful feature for clients consuming the API.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -68,6 +70,34 @@ var (
func (c *crud) FindFlags(params flag.FindFlagsParams) middleware.Responder {
fs := []entity.Flag{}
q := entity.NewFlagQuerySet(getDB())
queryParams := map[string]string{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to put the query params in swagger query params.

https://github.com/checkr/flagr/blob/master/swagger/flags.yaml#L1

For example, https://swagger.io/docs/specification/describing-parameters/#query-parameters

After the change of the swagger definitions, run make gen to get the latest swagger model. We can get type safety and API doc for free in this case.

@amalfra
Copy link
Contributor Author

amalfra commented Jun 11, 2018

@zhouzhuojie I have updated the pr to use swagger.yml for query param validation

Copy link
Collaborator

@zhouzhuojie zhouzhuojie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zhouzhuojie zhouzhuojie merged commit 1c23552 into openflagr:master Jun 11, 2018
@kalebdf
Copy link

kalebdf commented Jul 6, 2018

Awesome work @amalfra 👍

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.

3 participants