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

First-class JSON parameter type #1135 #1163

Merged
merged 1 commit into from Sep 24, 2015

Conversation

dslh
Copy link
Contributor

@dslh dslh commented Sep 22, 2015

Addresses issue #1135. Allows type: JSON and type: Array[JSON]
as options for Grape::DSL::Parameters::requires and ::optional,
allowing convenient handling of parameters supplied as JSON-encoded
strings.

See README.md#first-class-json-types for usage.

Addresses issue ruby-grape#1135. Allows `type: JSON` and `type: Array[JSON]`
as options for `Grape::DSL::Parameters::requires` and `::optional`,
allowing convenient handling of parameters supplied as JSON-encoded
strings.

See README.md#first-class-json-types for usage.
@dslh dslh changed the title First-class JSON parameter type First-class JSON parameter type #1135 Sep 22, 2015
@@ -51,6 +58,14 @@ def valid_type?(val)
end

def coerce_value(val)
# JSON is not a type as Virtus understands it,
Copy link
Member

Choose a reason for hiding this comment

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

As a future improvement maybe we should write a custom Virtus type for this, to be consistent and avoid special handling?

@dblock
Copy link
Member

dblock commented Sep 24, 2015

This is perfect. I am merging it, it's an +:100: feature.

dblock added a commit that referenced this pull request Sep 24, 2015
@dblock dblock merged commit b559a5a into ruby-grape:master Sep 24, 2015
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