Skip to content
New issue

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

javax @NotNull annotation makes parameter as requestbody-parameter #2855

Closed
dulong opened this issue Jan 10, 2019 · 2 comments
Closed

javax @NotNull annotation makes parameter as requestbody-parameter #2855

dulong opened this issue Jan 10, 2019 · 2 comments
Labels

Comments

@dulong
Copy link

dulong commented Jan 10, 2019

Version 2.9.2, the latest version since the issue created.

I think it's a bug.

Actually not only the @NotNull annotation will cause the bug, but also any other annotation which is not a Spring data binding annotation such as @RequstParam, @PathVariable, @RequestPart, and so on.

when

  @ApiOperation(value = "bug2855")
  @RequestMapping(value = "/2855", method = POST, consumes = APPLICATION_FORM_URLENCODED_VALUE)
  public void bug2855(
          @NotNull String a,
          String b) {
  }

expected generated api operation json

{
  "/bugs/2855": {
    "post": {
      "tags": [
        "Bugs"
      ],
      "summary": "bug2855",
      "operationId": "bug2855UsingPOST_1",
      "consumes": [
        "application/x-www-form-urlencoded"
      ],
      "parameters": [
        {
          "in": "formData",
          "name": "a",
          "description": "a",
          "required": true,
          "type": "string"
        },
        {
          "in": "formData",
          "name": "b",
          "description": "b",
          "required": false,
          "type": "string"
        }
      ],
      "responses": {
        "200": {
          "description": "OK"
        }
      },
      "deprecated": false
    }
  }
}

actual

{
  "/bugs/2855": {
    "post": {
      "tags": [
        "Bugs"
      ],
      "summary": "bug2855",
      "operationId": "bug2855UsingPOST_1",
      "consumes": [
        "application/x-www-form-urlencoded"
      ],
      "parameters": [
        {
          "in": "body",
          "name": "a",
          "description": "a",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "b",
          "in": "formData",
          "description": "b",
          "required": false,
          "type": "string"
        }
      ],
      "responses": {
        "200": {
          "description": "OK"
        }
      },
      "deprecated": false
    }
  }
}

The difference is the type(the in field) of parameter a.

@stale
Copy link

stale bot commented Jun 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 24, 2020
@stale
Copy link

stale bot commented Jul 8, 2020

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant