Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

16 changes: 10 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '22.x'
cache: 'npm'
- name: Install Packages
run: npm ci
Expand All @@ -30,15 +30,19 @@ jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ['20.x', '22.x', '24.x']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install Packages
run: npm ci
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint -e
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx nano-staged
npm test
3 changes: 0 additions & 3 deletions docs/VALIDATOR-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ const app = new ExpressKit(nodekit, routes);
```

Ключевые свойства:

- `operationId`: Опциональное поле контракта, которое становится именем обработчика, используемым в логах, контексте запроса и телеметрии — согласовано с `operationId` объекта операции OpenAPI. Приоритет разрешения имени обработчика: `handlerName` на уровне роута > `config.operationId` > `handler.name` > `unnamedController`.
- `request` / `response`: Определяют схемы для валидации запроса и ответа.

Expand All @@ -156,7 +155,6 @@ const app = new ExpressKit(nodekit, routes);
```

Ключевые свойства:

- `manualValidation`: Установите в `true`, чтобы отключить автоматическую валидацию запроса.

- **`handler(req, res)`**: Ваш обработчик роута Express, получающий расширенные объекты `req` и `res`.
Expand All @@ -176,7 +174,6 @@ const app = new ExpressKit(nodekit, routes);
Объект `res` в вашем обработчике расширен следующими методами:

- **`res.sendTyped(statusCode, data?)`**:

- Отправляет JSON-ответ с указанным `statusCode`.
- Аргумент `data` **проверяется на типы** во время компиляции по схеме, связанной с `statusCode`.
- **Не выполняет валидацию во время выполнения** и не преобразует данные.
Expand Down
3 changes: 0 additions & 3 deletions docs/VALIDATOR.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ The primary tool is the `withContract` higher-order function, which wraps Expres
```

Key properties:

- `operationId`: Optional contract field that becomes the handler name used in logs, the per-request context, and telemetry self-stats — aligned with the OpenAPI Operation Object's `operationId`. The handler name resolution priority is: route-level `handlerName` > `config.operationId` > `handler.name` > `unnamedController`.
- `request` / `response`: Define the schemas for request and response validation.

Expand All @@ -156,7 +155,6 @@ The primary tool is the `withContract` higher-order function, which wraps Expres
```

Key properties:

- `manualValidation`: Set to `true` to disable automatic request validation.

- **`handler(req, res)`**: Your Express route handler, receiving enhanced `req` and `res` objects.
Expand All @@ -176,7 +174,6 @@ The `req` object in your handler is enhanced:
The `res` object in your handler is enhanced with the following methods:

- **`res.sendTyped(statusCode, data?)`**:

- Sends a JSON response with the given `statusCode`.
- The `data` argument is **type-checked** at compile time against the schema associated with `statusCode`.
- It **does not perform runtime validation** or data transformation.
Expand Down
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import mainConfig from '@gravity-ui/eslint-config';
import serverConfig from '@gravity-ui/eslint-config/server';
import prettierConfig from '@gravity-ui/eslint-config/prettier';

export default [
{ignores: ['dist/**']},
...mainConfig,
...serverConfig,
...prettierConfig,
{
rules: {
'no-param-reassign': [1, {props: false}],
},
},
];
Loading
Loading