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

How to define notes to an operation? #212

Closed
calfzhou opened this issue Feb 11, 2015 · 5 comments · Fixed by #286
Closed

How to define notes to an operation? #212

calfzhou opened this issue Feb 11, 2015 · 5 comments · Fixed by #286

Comments

@calfzhou
Copy link
Contributor

i'm using grape 0.10.0 and grape-swagger 0.9.0.

As mentioned by grape documentation, i can add detail to each method, but the generated swagger doc doesn't contain information defined in detail. Swagger's operation notes filed is always an empty string.

I checked grape-swagger source code, the notes is generated by the following code:

notes       = @@documentation_class.as_markdown(route.route_notes)

But i've no idea about what route.route_notes is.

@dblock
Copy link
Member

dblock commented Feb 11, 2015

Please see the README for how notes are used, there's a nice example, including how to do this in markdown.

@dblock dblock closed this as completed Feb 11, 2015
@calfzhou
Copy link
Contributor Author

Yes i read that, the problem is that the example only adds a notes to grape description, no other grape standard fields. But i still need define a success, several failures, i tried different ways but none of them works:

desc 'Gets something', notes: 'details' do
  success AnEntity
end

Above will add success to doc but no notes.

desc 'Gets something', notes: 'details', success: AnEntity

Above could generate notes, but no success.

desc 'Gets something' do
  notes 'details'
  success AnEntity
end

Above will fail due to undefined method notes.

@calfzhou
Copy link
Contributor Author

seems related to #165

@dblock
Copy link
Member

dblock commented Feb 11, 2015

Thanks @calfzhou for bringing this up. Lets talk about it in ruby-grape/grape#920. See my comments, I would take a PR that addresses those two issues described.

@dblock
Copy link
Member

dblock commented Feb 11, 2015

Reopening this since we basically lack support for notes given the new Grape DSL syntax with a block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants