-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
I am setting up the middleware like this in my config/application.rb;
if Rails.env.development? || Rails.env.test?
config.middleware.use Committee::Middleware::RequestValidation,
schema_path: 'docs/schema-bundled.yml',
params_key: 'action_dispatch.request.request_parameters'
config.middleware.use Committee::Middleware::ResponseValidation,
schema_path: 'docs/schema-bundled.yml',
raise: true
endNow whenever I render anything from my controllers, like;
def doorkeeper_forbidden_render_options(*)
{ json: { error: { code: 'forbidden', message: 'This action is outside the authorized scopes' } } }
endI always receive a Committee:InvalidResponse error;
Committee::InvalidResponse: #/components/responses/forbidden/content/application~1json/schema expected , but received Hash: {"error"=>{"code"=>"forbidden", "message"=>"This action is outside the authorized scopes"}}
Where the schema definitions looks like this;
openapi: 3.0.0
paths:
'/api/v1/accounts/{account_id}':
get:
operationId: get_account
summary: Retrieve an existing acocunt
description: >
To show information about an account, send a GET request to
`/api/v1/accounts/$ACCOUNT_ID`.
tags:
- Accounts
parameters:
- $ref: '#/components/parameters/account_id'
responses:
'401':
$ref: '#/components/responses/unauthorized'
components:
parameters:
account_id:
in: path
name: account_id
description: A unique identifier for an account.
required: true
schema:
type: string
format: uuid
example: acf19357-d974-4843-9525-e98426ad5346
schemas:
error:
type: object
properties:
code:
type: string
description: >
A short identifier corresponding to the HTTP status code returned.
For example, the identifier for a response returning a 404 status code
would be "not_found."
example: not_found
message:
type: string
description: >
A message providing additional information about the error,
including details to help resolve it when possible.
example: The resource you were accessing could not be found.
request_id:
type: string
format: uuid
description: |
Optionally, some endpoints may include a request ID that should be
provided when reporting bugs or opening support tickets to help
identify the issue.
example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9
required:
- code
- message
responses:
forbidden:
description: Forbidden.
content:
application/json:
schema:
type: object
properties:
error:
$ref: '#/components/schemas/error'
example:
error:
code: forbidden
message: Forbidden to authenticate you.Am I missing maybe some configuration value?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels