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

[REQUEST] Support OAS 3.1 Parameters in generator #720

Open
1 of 3 tasks
tariq-cigna opened this issue Dec 29, 2023 · 0 comments
Open
1 of 3 tasks

[REQUEST] Support OAS 3.1 Parameters in generator #720

tariq-cigna opened this issue Dec 29, 2023 · 0 comments

Comments

@tariq-cigna
Copy link

tariq-cigna commented Dec 29, 2023

Is your feature request related to a problem? Please describe.

The generate task does not support 3.1.0 due to the location of parameter under path.
OAS 3.1 has removed the parameters field from the path object.

When the openapi version is set to 3.1.0 in the document config, config.openapi_specs, the parameters are not rendered in Swagger UI from freshly generated rswag specs.

Describe the solution you'd like

Parameters should be generated under the operation, not path.

For example, the current generation outputs this:

  path '/foo/{id}' do
    # You'll want to customize the parameter types...
    parameter name: 'id', in: :path, type: :string, description: 'id'

    get('show foo') do
      response(200, 'successful') do
        let(:id) { '123' }
        ...
      end
    end
  end

This would be the preferred output for OAS 3.1. This is also be backwards compatible with 3.0.1

  path '/foo/{id}' do
   
      get('show foo') do
         # You'll want to customize the parameter types...
         parameter name: 'id', in: :path, type: :string, description: 'id'

         response(200, 'successful') do
           let(:id) { '123' }
           ...
         end
    end
  end

Describe alternatives you've considered

Manually moving the parameters from path to the operation section.

Relates to which version of OAS (OpenAPI Specification)

  • OAS2
  • OAS3
  • OAS3.1
@romanblanco romanblanco added this to the OAS 3.1 compatibility milestone Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants