question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

openapi does not display nullable schemas

See original GitHub issue

Bug Report

Current behavior

When using the openapi feature i noticed, that some of my nested DTOs are not correctly shown when it is nullable:

image

when removing nullable: true - the DTO is displayed correctly.

Input Code

@ApiProperty({ type: LogisticsPartnerDTO, nullable: true })
customer!: Nullable<LogisticsPartnerWithLocationRes>;

Expected behavior

I would expect, that the type is shown in the Swagger Docs even though it is nullable.

Environment


"@nestjs/common": "7.6.12",
"@nestjs/core": "7.6.12",
"@nestjs/swagger": "^4.7.13",

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kamilmysliwieccommented, Jul 8, 2021

We’ll bump as soon as the underlying packages (https://www.npmjs.com/package/swagger-ui-dist or fastify-swagger) support it as well!

2reactions
lkostrowskicommented, May 27, 2021

Hi @kamilmysliwiec , is there any plan to bump this package to OAS 3.1?

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Nullable property is not presented in the Swashbuckle ...
c# - Nullable property is not presented in the Swashbuckle. AspNetCore openapi schema properly - Stack Overflow. Stack Overflow for Teams – ...
Read more >
How to specify a property can be null or a reference
This is a real-world problem for my project: complex objects reference other objects, but in some cases, the referenced object is NULL, i.e,...
Read more >
Handling the null type in JSON schema - IBM
Handling the null type in JSON schema. Swagger 2.0 does not support the null type because Swagger supports only a subset of JSON...
Read more >
Supported JSON Schema Keywords - Swagger
type – the value must be a single type and not an array of types. null is not supported as a type, use...
Read more >
Schema generation rules · GitBook - Goswagger.Io
In JSONSchema, but not in Swagger 2.0: anyOf , oneOf and not constructs are not supported (this is for OpenAPI 3); the null...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found