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

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

Open
agiveygives opened this issue May 31, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@agiveygives
Copy link

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:
                ...
@exoego
Copy link
Owner

exoego commented Sep 24, 2024

:openapi metadata is currently extracted only from it(...) blocks.
Supporting metadata in describe(...) block seems to make sense for tags (not sure for summary).

If someone want to contribute to this feature, metadata extraction can be found:

metadata = example.metadata[:openapi] || {}

metadata = example.metadata[:openapi] || {}

metadata = example.metadata[:openapi] || {}

@exoego exoego added enhancement New feature or request help wanted Extra attention is needed labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants