[BUG] Root body not passed to curl when using openapi 3.0.1
arinhouck opened this issue · 0 comments
arinhouck commented
Describe the bug
Add root parameter object using openapi: '3.0.1'
and it doesn't pass body to curl on swagger-ui.
Steps to Test or Reproduce
- Setup using
config.swagger_docs = {
'v1/swagger.json' => {
openapi: '3.0.1',
- Add a test using root
require 'swagger_helper'
RSpec.describe 'oauth/tokens', type: :request do
path '/oauth/token' do
parameter name: :root, in: :body, schema: {
type: :object,
properties: {
client_id: {
type: :string,
description: 'Client id'
},
grant_type: {
type: :string,
enum: %w[assertion],
description: 'The grant types we support from oauth specification'
},
provider: {
type: :string,
enum: %w[linkedin],
description: '3rd party oauth provider slug'
},
assertion: {
type: :string,
description: 'oauth code from the provider'
}
}
}
post('exchange code for token') do
consumes 'application/json'
response(200, 'successful') do
let(:provider) { 'linkedin' }
let(:client_id) { oauth_app.uid }
let(:grant_type) { 'assertion' }
let(:assertion) { 'some_code' }
let!(:oauth_app) { create(:oauth_application, :linkedin) }
let(:root) do
{
provider: provider,
client_id: client_id,
grant_type: grant_type,
assertion: assertion
}
end
after do |example|
example.metadata[:response][:content] = {
'application/json' => {
example: JSON.parse(response.body, symbolize_names: true)
}
}
end
run_test!
end
end
end
end
- Generate rswag and try to use swagger-ui
![Screenshot 2023-07-03 at 4 51 35 PM](https://private-user-images.githubusercontent.com/6051748/250691419-70c9b8ce-5579-48cd-b4b4-e40da2888a2f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTAwMTYyMTIsIm5iZiI6MTcxMDAxNTkxMiwicGF0aCI6Ii82MDUxNzQ4LzI1MDY5MTQxOS03MGM5YjhjZS01NTc5LTQ4Y2QtYjRiNC1lNDBkYTI4ODhhMmYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMDlUMjAyNTEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzRkM2VhMDZlNzZmYWM1NWE1NDFjMzc0YTliZTFjOTczMGIwMDQ0NDVhYzk4MDExYTdlN2RlMzU3ZTlhOGRiYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.XXVGbm0si4FvlEAerLMnn_haXqJFdzJSpMtuvCUfbtU)
Expected behavior
I'd expect the curl to contain the json body like so:
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Dependency versions
The version of are you using for:
- Rswag: 2.9.0
- RSpec: 3.12.2 (rspec-core), rspec-rails (6.0.0)
- Rails: 7.0.5
- Ruby: 3.0.6
Relates to which version of OAS (OpenAPI Specification)
- OAS2
- OAS3
- OAS3.1