nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.09k stars 539 forks source link

"undefined" in OpenAPI spec when using @Crud and @Override #655

Open rbarriuso opened 3 years ago

rbarriuso commented 3 years ago

Copied from https://github.com/nestjs/swagger/issues/1121

I'm submitting a...


[ ] 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.

Current behavior

"undefined" entries are present in the OpenAPIObject created by SwaggerModule.createDocument(), when using the @Override decorator from @nestjsx/crud.

Expected behavior

No "undefined" paths in the OpenAPI spec generated.

Minimal reproduction of the problem with instructions

  1. Download nest-crud-openapi-issue-project.zip.
  2. Check README.md for instructions about how to start the project. Requires docker-compose.
  3. See the generated openapi-spec.json file. Search for occurrences of undefined. Two are found.
  4. Comment out the method which has the @Override decorator in users.controller.ts.
  5. Start the project again and check openapi-spec.json. No occurrences of undefined are found.

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

We write the openapi-spec.json file in order to generate the client side code with openapi-generator-cli. Due to these occurrences of undefined in the file, the generator outputs warnings.

Environment

"@nestjs/swagger": "^4.7.9"
"@nestjsx/crud": "^4.1.0"

Also checked with "@nestjsx/crud": "^4.6.2"

For Tooling issues:

Others:

N/A

TyrisDavidLopez commented 3 years ago

I have the same issue on nestjs/swagger 4.8.0

shorsher commented 3 years ago

@TyrisDavidLopez @rbarriuso, did either of you find a solution for this?

TyrisDavidLopez commented 3 years ago

None, as workaround, I'm processing the json to remove the 'undefined' fields on is used. But is not a solution.