swagger-blocks icon indicating copy to clipboard operation
swagger-blocks copied to clipboard

Specifying headers for OPTIONS method (CORS)

Open ericpeters0n opened this issue 8 years ago • 1 comments

Any hints on how to translate something like this to Swagger-Blocks?

      200:
        description: Returns the CORS response headers
        headers:
          Access-Control-Allow-Origin:
            type: string
          Access-Control-Allow-Credentials:
            type: boolean
          Access-Control-Allow-Headers:
            type: array
            collectionFormat: csv
          Access-Control-Allow-Methods:
            type: array
            collectionFormat: csv
          Access-Control-Max-Age:
            type: integer

ericpeters0n avatar Feb 07 '17 07:02 ericpeters0n

I think this will work

        response 200 do
          key :description, 'Success'
          header 'Access-Control-Allow-Methods' do
            key :type, :array
            key :collectionFormat, :csv
            items do 
               key :type, :string
           end
          end
          header :another do
            key :type, :string
          end

geetotes avatar Nov 03 '17 03:11 geetotes