We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The generated schema field shouldn't be empty.
schema
Given the following controller method:
@Post("/pet") @Operation( operationId = 'CreatePet', summary = 'Create a pet', requestBody = @RequestBody(description = 'Pet create request', content = @Content(schema = @Schema(implementation = CreatePetRequest))), responses = [ @ApiResponse(responseCode = '200', description = 'OK', content = @Content(schema = @Schema(implementation = CreatePetResponse))), @ApiResponse(responseCode = '400', description = 'Bad request', content = @Content(schema = @Schema(implementation = ErrorResponse))), @ApiResponse(responseCode = '403', description = 'Operation not allowed'), @ApiResponse(responseCode = '409', description = 'Duplicated element', content = @Content(schema = @Schema(implementation = ErrorResponse))) ] ) HttpResponse<CreatePetResponse> createPet(@Body CreatePetRequest body) { def respBody = new CreatePetResponse(pet: body.pet) return HttpResponse.ok(respBody) }
The generated specs contain empty schemas for responses:
openapi: 3.0.1 info: title: mn-openapi-empty-schema version: "0.0" paths: /pet: post: summary: Create a pet operationId: CreatePet requestBody: description: Pet create request content: schema: {} # <----- empty schema here too, but the block below looks alright application/json: schema: $ref: '#/components/schemas/CreatePetRequest' required: true responses: "200": description: OK content: schema: {} # <---- empty schema for all responses "400": description: Bad request content: schema: {} "403": description: Operation not allowed "409": description: Duplicated element content: schema: {} components: schemas: CreatePetRequest: type: object properties: pet: $ref: '#/components/schemas/Pet' Pet: type: object properties: name: type: string
The same method in Micronaut 3.x generates something such as the following:
responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/CreatePetResponse'
./gradlew compileGroovy
https://github.com/tcrespog/mn-openapi-empty-schema
4.2.3
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Expected Behavior
The generated
schema
field shouldn't be empty.Actual Behaviour
Given the following controller method:
The generated specs contain empty schemas for responses:
The same method in Micronaut 3.x generates something such as the following:
Steps To Reproduce
./gradlew compileGroovy
Environment Information
Example Application
https://github.com/tcrespog/mn-openapi-empty-schema
Version
4.2.3
The text was updated successfully, but these errors were encountered: