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.

Swagger plugin incorrectly parses optional fields

See original GitHub issue

I’m submitting a…


[x] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Minimal reproduction of the problem with instructions

  1. Enable “@nestjs/swager/plugin”
  2. Create following DTO
OptonalPropDto {
  field?: string;
}
  1. Check output swagger document
            "OptonalPropDto ": {
                "type": "object",
                "properties": {
                    "field": {
                        "type": "object"
                    }
                }
            }

Field type should have “string” value.

What is the motivation / use case for changing the behavior?

Environment

Downgrading @nestjs/cli helps to resolve the issue.


"@nestjs/swagger": "4.2.8"
"@nestjs/cli": "6.14.2"

 
For Tooling issues:
- Node version: 12.15
- Platform:  Windows

Others:

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kamilmysliwieccommented, Feb 19, 2020

It should be fixed in 4.2.11

0reactions
lock[bot]commented, May 20, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optional object field in Dto does not parse to optional with ...
I have installed the @nestjs/swagger/plugin in nest-cli.json and it has been up running fine. Creating an optional field with ? symbol on ...
Read more >
Swagger parsing fails due to format suffix generated by ...
Anyone have ideas on how to help? Are my docs wrong or am I using the parser wrong? swagger · swagger-maven-plugin.
Read more >
Swagger: Specify Two Responses with the Same ...
Learn how to write an API specification that returns two different objects for the same response code using Java and Swagger.
Read more >
Integrating Swagger UI with the rest of your docs
Whenever discussions about Swagger and other REST API specifications ... Option 3: Parse the OpenAPI specification document; Option 4: Store ...
Read more >
ReadMe: OpenAPI and Swagger for API Documentation
After Swagger became the de facto standard for API definition, the industry recognized the need for a vendor-neutral option. In 2016, developer ...
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