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 minimum and maximum #69

Merged

Conversation

storey
Copy link
Contributor

@storey storey commented Apr 18, 2024

This adds support for generating the minimum and maximum swagger keywords.

There are two ways to produce these keywords:

1. Explicitly set a minimum or maximum property in the documentation object

documentation: {
  minimum: 0,
  maximum: 100,
}

2. Set the values property in the documentation object to a numeric range (which matches grape's built in validation for numeric min + max)

documentation: {
  values: 0..100,
}

@@ -58,6 +58,7 @@ Metrics/BlockLength:
# Configuration parameters: CountComments, Max, CountAsOne.
Metrics/ClassLength:
Exclude:
- 'lib/grape-swagger/entity/attribute_parser.rb'
Copy link
Contributor Author

@storey storey Apr 18, 2024

Choose a reason for hiding this comment

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

This is not ideal but when I split up this file into two files I found that there were a bunch of existing MethodLength violations within it that we were ignoring, so I figured I would just keep the status quo of the file not being fully rubocop compliant?

Let me know if we should just refactor that whole file to be compliant (and pull the param parser out) in a separate PR

Copy link
Collaborator

@mscrivo mscrivo left a comment

Choose a reason for hiding this comment

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

looks great! just that one rubocop item to fix.

@mscrivo mscrivo merged commit 2308ef0 into ruby-grape:master Apr 19, 2024
6 checks passed
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.

None yet

2 participants