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

Added documentation support to parameters #572

Merged
merged 1 commit into from
Feb 4, 2014

Conversation

johnallen3d
Copy link
Contributor

Additional documentation can be added to a parameter by providing a documentation hash.

params do
  optional :first_name, type: String, documentation: { example: 'Jim' }
  requires :last_name, type: String, documentation: { example: 'Smith' }
end

Previous discussion in this issue.

@dblock
Copy link
Member

dblock commented Feb 4, 2014

I like it, merging.

dblock added a commit that referenced this pull request Feb 4, 2014
Added documentation support to parameters
@dblock dblock merged commit bc0ad13 into ruby-grape:master Feb 4, 2014
@mscrivo
Copy link
Contributor

mscrivo commented Aug 14, 2023

I know this is a very old PR, but it's important to note that examples on parameters are only supported in OpenAPI v3, which grape does not support. If you add an example on a param using this, and then run the resulting spec through any OpenAPI validator tool, it will fail. IMO, grape should only allow valid OpenAPI v2 documentation, until it supports v3 properly.

@dblock
Copy link
Member

dblock commented Aug 14, 2023

@mscrivo Want to add something in the README wrt OpenAPI versions?

@mscrivo
Copy link
Contributor

mscrivo commented Aug 14, 2023

@mscrivo Want to add something in the README wrt OpenAPI versions?

What would we say though? I'd prefer if people didn't hit this kind of thing in the first place and have to look in the README for some explanation. I'm thinking we need something that validates any documentation grape spits out against an OpenAPI v2 validator as a PR check, if that's at all possible.

Or someone puts in the effort to get the v3 migration done 😆

@dblock
Copy link
Member

dblock commented Aug 14, 2023

I'd prefer someone contribute to v4 migration too! But it could just say something like "Note: Grape currently supports OpenAPI x.y. See #xyz for adding v3 support."

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