rspec-openapi icon indicating copy to clipboard operation
rspec-openapi copied to clipboard

Customizations on an it-block completely remove customizations set on a parent describe

Open agiveygives opened this issue 8 months ago • 1 comments

In some situations, I was my test to be more descriptive, but I don't necessarily want my docs to have the same description. However, when I customize the description on the test level, the values set on the describe are lost. For example, the following test...

describe V1::MyController, openapi: {
  summary: 'Do the stuff that my controller does',
  tags: ["My tag"],
} do
  it 'returns a 200 status with a json body' , openapi: { description: 'Success' } do
    get 'v1/my'
    expect(response).to have_http_status(:ok)
    expect(response.parsed_body).to eq(expected_response)
  end
end

produces the following yaml

"/v1/my":
    get:
      summary: index
      tags:
      - V1::My
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                ...

But I would expect it to output the following yaml

"/v1/my":
    get:
      summary: Do the stuff that my controller does
      tags:
      - My tag
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                ...

agiveygives avatar May 31 '24 18:05 agiveygives