-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Currently, grape-swagger-entity assumes that required
is false
unless it's explicitly set with documentation: { required: true }
:
params.select { |_, options| options.fetch(:documentation, {}).fetch(:required, false) } |
grape-entity always renders fields by default. Conditional exposure is an opt-in feature: https://github.com/ruby-grape/grape-entity?tab=readme-ov-file#conditional-exposure
I think it would make more sense to change the behavior as follows:
- if
options.dig(:documentation, :required)
is set, use that - otherwise, if
options[:if]
is set, setrequired
tofalse
- otherwise, set
required
totrue
What do you think?
Metadata
Metadata
Assignees
Labels
No labels