
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@trendyol/eslint-plugin-nest-swagger-checker-lint
Advanced tools
Eslint Plugin To Check Swagger Related Fields For NestJs
nest-swagger-checker-linter is linter version of nest-swagger-checker package to use it as ESLint rule.
This package uses nsc(nest-swagger-checker) package inside its own.
Like nsc package, this linter package can be configured by using .swautomaterc file at the root path of project.
You can see detail of configuration
Like other eslint plugins, this plugin needs to be added to eslintrc configuration.
// .eslintrc.json file in project
...
"plugins": [
"nest-swagger-checker-lint"
],
...
"rules": {
"nest-swagger-checker-lint/api-property-rule": "error",
"nest-swagger-checker-lint/api-information-rule": "error",
"nest-swagger-checker-lint/api-param-rule": "error",
....
}
Lets assume you have endpoint method in a controller like below:
@Post('')
@HttpCode(HttpStatus.OK)
..
@AnotherDecorator()
public async create(
...
)
You will get eslint error because there is no ApiOperation decorator ta describe summary and description for endpoint.
Error should be like below:
💡 You can enable/disable this checking by setting scopes.endpoint.information.check config value
There is a request param for endpoint method in below example but name in ApiParam decorator does not match with it.
....
@ApiParam({ name: 'customerId', description: 'Customer ID', type: Number, example: 60 })
async getCount(@Param('userId') userId: string, @Query() parameters: Parameters): Promise<Count> {
return this.service.getCount(Number(userId), parameters);
}
...
You will get eslint error like below.
💡 You can enable/disable this checking by setting scopes.endpoint.params.check config value
If you have request parameter that given with @Param decorator like above but you don't have any @ApiParam decorator, you will also get eslint error.
....
@ApiResponse({ status: HttpStatus.BAD_REQUEST, description: 'Request Is Not Valid' })
@ApiResponse({ status: HttpStatus.INTERNAL_SERVER_ERROR, description: 'An Error Occurred' })
async getCount(@Param('userId') userId: string, @Query() parameters: Paramters): Promise<Count> {
return this.affiliateAdService.getCount(Number(userId), searchParameters);
}
💡 You can enable/disable this checking by setting scopes.endpoint.params.check config value
Lets assume you have a custom query class type for your endpoint endpoint method like below:
async getCount(..., @Query() parameters: Parameters): Promise<Count> {
return this.service.getCount(Number(sellerId), parameters);
}
....
export class SearchParametersDto {
@IsInt()
@IsOptional()
@IsPositive()
@Type(() => Number)
@ApiProperty({
type: Number,
description: 'Pagination Index, Default: 1',
example: 1,
required: false,
})
public pageIndex?: number;
....
If you gave pattern something like that ^[A-Z][a-z0-9]*(?:\s[a-z0-9]*)*$, you will give eslint error because your description text should be match with your pattern.
In this example, only first words first letter should be uppercase according to example pattern. Eslint error will be like below:
💡 You can enable/disable this checking by setting scopes.endpoint.query.description.check config value and you can set pattern by setting scopes.endpoint.query.description.pattern value.
FAQs
Eslint Plugin To Check Swagger Related Fields For NestJs
We found that @trendyol/eslint-plugin-nest-swagger-checker-lint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.