Hey,
I recently tried the demo project of nestjsx/crud (nestjsx/crud/integration/typeorm).
I recognized that the swagger documentation contains an additional id parameter for every route - even for "get all" or "create one", where it's not necessary to provide such an id at all.
Here is what I mean:

In the code, the params attribute is explicitly set to {} (empty).
Is this a bug?
// ...
@Crud(Company, {
params: {},
routes: {},
options: {
join: {
users: {
exclude: ['password'],
},
},
sort: [{ field: 'id', order: 'DESC' }],
maxLimit: 5,
cache: 10000,
},
})
@ApiUseTags('companies')
@Controller('companies')
export class CompaniesController {
// ...
[EDIT]
In helpers.js in function setDefaultCrudOptions() the parameter id: number is used by default:
function setDefaultCrudOptions(crudOptions, target) {
const check = (obj) => shared_utils_1.isNil(obj) || !shared_utils_1.isObject(obj) || !Object.keys(obj).length;
if (check(crudOptions.params)) {
crudOptions.params = { id: 'number' };
}
// ...
}
Is this really necessary? Since not every route has an id parameter.
Seems this issue was fixed by https://github.com/nestjsx/crud/commit/75418c35d4428d767b507e3237c78a76e7468990 .
Sorry for not closing thing issue on time. Yep it was fixed with v4.0.0
Most helpful comment
Sorry for not closing thing issue on time. Yep it was fixed with v4.0.0