Skip to content

Micronaut 2.2.0 adds requestBody as a required parameters to Put/Post requests #402

@andyndang

Description

@andyndang

Thanks for reporting an issue, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (https://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create a Post API with a single parameter and without any request body
    @Post(
            uri = "/upload/{id}",
            produces = [MediaType.APPLICATION_JSON]
    )
    fun upload(
            id: String,

    ) {
        print("Do nothing")
    }
  1. Generate the OpenAPI YAML

Expected Behaviour

API should look like this:

  /v1/repro/upload/{id}:
    post:
      tags:
        - 'ReproController '
      summary: summary
      description: desc
      operationId: id2
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string

Actual Behaviour

requestBody is added

  /v1/repro/upload/{id}:
    post:
      tags:
        - 'ReproController '
      summary: summary
      description: desc
      operationId: id2
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
        required: true

Environment Information

  • Operating System: MacOS X
  • Micronaut Version: 2.2.0
  • JDK Version: 1.8

Example Application

https://github.com/andyndang/micronaut-swagger-yml-bug/tree/89b20c9451f333e8fb17678cff0ca6ac063a415f

2.1.0 YAML: https://github.com/andyndang/micronaut-swagger-yml-bug/blob/89b20c9451f333e8fb17678cff0ca6ac063a415f/schema_2.1.0.yml

2.2.0 YAML: https://github.com/andyndang/micronaut-swagger-yml-bug/blob/89b20c9451f333e8fb17678cff0ca6ac063a415f/schema_2.2.0.yml

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions