nestjsx / crud

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

feat(crud): Customizable CrudRoutesFactory #629

Closed tbrannam closed 3 years ago

tbrannam commented 3 years ago

CrudRoutesFactory has a number of important elements related to Swagger generation that is generally hidden. By providing a subclass of CrudRoutesFactory to @Crud options, one is able to expose hooks to allow customization of Swagger documentation.

The author is primarily concerned with being able to customize the opererationId to reduce the length of identifiers used by common Code-generation tools.

tbrannam commented 3 years ago

I haven't a clue on how to make a PR for the Wiki

crudRoutesFactory

@Crud({
  ...
  crudRoutesFactory?: typeof CrudRoutesFactory
  ...
})

Optional

Allow customization of the CrudRoutesFactory to allow for specialization of Swagger documentation. Callers should subclass CrudRoutesFactory and pass the Class to the options.

cschuff commented 3 years ago

This is awesome. We need this! It is not a very big change either. Can anybody please approve this?

cschuff commented 3 years ago

@tbrannam Can we also export the crud dir from root index.ts? BR

cschuff commented 3 years ago

@zMotivat0r your 5.0.0-alpha.0 release does not seem to contain this change...

Can neither find it in my node_modules nor in the downloaded zip from the release page. It is also not contained in master nor v5 source...

e.g. https://github.com/nestjsx/crud/blob/v5/packages/crud/src/interfaces/crud-options.interface.ts

Did you revert it by any chance?

michaelyali commented 3 years ago

@cschuff sorry for that but I have no idea why this happened. As you can see it says that it merged bit it's very weird. I'll fix it

cschuff commented 3 years ago

It's an alpha, so who cares 😜

Thanks man 🙏🏻

michaelyali commented 3 years ago

@cschuff fixed in 5.0.0-alpha.1

cschuff commented 3 years ago

@zMotivat0r Thanks.

Sorry to bother you again, but:

Unfortunately the methods in CrudRoutesFactory are still private while most of them should be protected according to https://github.com/nestjsx/crud/pull/629/files#diff-1b3296236a76cc2e63c59fed4251b70162913dd6dc759629f6aad1bf6e6fabfcL44

michaelyali commented 3 years ago

@cschuff please double check it. Here is the brand new test project with the latest @nestjsx/crud package installed

Снимок экрана 2021-02-08 в 13 38 47
cschuff commented 3 years ago

🙈 you are right, my fault...

Sorry for bothering!