ruby-grape / grape-swagger

Add OAPI/swagger v2.0 compliant documentation to your grape API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with do blocks?

echan00 opened this issue · comments

I'd like to add header parameters to the endpoint below:

      desc "Send basic GET request to test API.\nRequest should respond with 'OK'" do
        summary 'Test API'
        detail 'Send basic GET request to test API'
        failure [ { code: 400, message: 'Invalid request.' }]
        success message: '-'
      end                  
      get '/translate' do
        status 200
      end

I see in the documentation this is how you do it with one line:

desc "Return super-secret information", {
  headers: {
    "XAuthToken" => {
      description: "Valdates your identity",
      required: true
    },
    "XOptionalHeader" => {
      description: "Not really needed",
      required: false
    }
  }
}

Since I have other information in the endpoint, how do I do this in a do block? I've been looking at this all day but can't figure out the correct syntax.

Nevermind, I'll just use one line