Forum Discussion

FernRguez's avatar
FernRguez
New Member
3 years ago

Error response content using annotations

I defiend an API like the one bellow and once I generated the code for Spring and once I run the project and open the swagger UI it does not identify the Error class defined on the schema and displays an error. I changed the class to Users for the 400 error and instead of the returning Error.class and it works.

 

Is there something that Im not defining correctly?

 

Resolver error at paths./api/users.get.responses.400.content.application/json.schema.$ref
Could not resolve reference: undefined undefined

 

API definition:

/users:
get:
tags:
- users
summary: Users list
operationId: users
responses:
200:
description: Users list
content:
'application/json':
schema:
$ref: '#/components/schemas/Users'
400:
$ref: '#/components/responses/Error400'
500:
$ref: '#/components/responses/Error500'

responses:
Error400:
description: error 400
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Error500:
description: error 500
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

schemas:
Error:
type: object
properties:
code:
type: string
desc:
type: string

No RepliesBe the first to reply