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

"nullable" is missing in response schema on primitive nullable type #2731

Closed
skironDotNet opened this issue Nov 1, 2023 · 2 comments
Closed
Labels
help-wanted A change up for grabs for contributions from the community

Comments

@skironDotNet
Copy link

Simple endpoint

    [ApiVersion("1.0")]
    [Route("intnull")]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [HttpGet]
    [SwaggerOperation(OperationId = "IntNull")]
    [SwaggerResponse(200, "nullable int", typeof(Nullable<int>))]  //this makes no diffrence
    public async Task<ActionResult<Nullable<int>>> IntNull([FromQuery] Dictionary<string, DateTime> test)
    {
        return this.Ok(null);
    }

the output

  "responses": {
          "200": {
            "description": "nullable int",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "application/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "text/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }

The schema should be

         "schema": {
                  "type": "integer",
                  "format": "int32",
                  "nullable": true
                }

but "nullable" is missing

@Havunen
Copy link

Havunen commented Feb 17, 2024

Havunen added a commit to Havunen/DotSwashbuckle that referenced this issue Feb 18, 2024
@martincostello martincostello added the help-wanted A change up for grabs for contributions from the community label Apr 14, 2024
@martincostello
Copy link
Collaborator

To make issue tracking a bit less overwhelming for the new maintainers (see #2778), I've created a new tracking issue to roll-up various nullability issues here: #2793.

We'll refer back to this issue from there and include it as part of resolving that issue, but I'm going to close this one to help prune the backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted A change up for grabs for contributions from the community
Projects
None yet
Development

No branches or pull requests

3 participants