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

Parameter validation: Raises error for all missing #886

Merged

Conversation

davidwessman
Copy link
Contributor

@@ -24,6 +24,20 @@ def initialize(param)
end
end

class ParamMultipleMissing < ParamError
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would be nice to inherit from the same error as ParamMissing, but we do not have the defined param here.

- Instead of just raising `ParamMissing` for the first missing,
  instead raise a compound `ParamMultipleMissing` if there are more
  than one missing.
- Adds specs for both POST and GET requests.
- Fixes Apipie#802
@davidwessman davidwessman force-pushed the 802-report-all-missing-parameters branch from 758bd7c to 2b44883 Compare June 8, 2023 19:20
@davidwessman
Copy link
Contributor Author

I have no good way to solve the last rubocop warnings, do you usually add ignores if the complexity grows? Not sure if I can split it up more since it is meta-programming

@PanosCodes
Copy link
Contributor

Running rubocop --auto-gen-config --exclude-limit 180 will add the errors to .rubocop_todo.yml

Copy link
Collaborator

@mathieujobin mathieujobin left a comment

Choose a reason for hiding this comment

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

Yep, its OK to ignore ModuleLength and BlockLength rubocop offenses, you can use the comment as @PanosCodes suggested. and I will merge.

Thank you

@mathieujobin mathieujobin merged commit bb7bdb4 into Apipie:master Jun 9, 2023
@davidwessman
Copy link
Contributor Author

Thanks! 🙂

@davidwessman davidwessman deleted the 802-report-all-missing-parameters branch June 9, 2023 08:09
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.

Report all missing required parameters instead of just the first
3 participants