feat(api): add employer need contract with requirement versions and recommendations

This commit is contained in:
shira committed 2026-10-06 07:39:05 +03:00
1 parent 3adb0ef9e4
commit a7d5781f2d
95 files changed
+25352 -26

No files matched your search

+71 -3
View File
@@ -14,7 +14,7 @@ From the repository root, `make -C api check` checks contracts and `make generat
## Contract conventions
`api/core/` fixes these conventions as reusable components in `openapi.yml` and the files under `components/`: schemas in `components/schemas/*_schemas.yml`, parameters in `parameters.yml`, response headers in `headers.yml`, responses in `responses.yml`, and examples in `examples.yml`. Operations reference them as they are added. Currently implemented: problem responses for errors of the Go public API and the ML service. Idempotency-Key storage, If-Match checks, and pagination are planned behavior for business operations; the declared `RegisterAccount` operation and the assessment commands require Idempotency-Key, but no operation stores keys yet.
`api/core/` fixes these conventions as reusable components in `openapi.yml` and the files under `components/`: schemas in `components/schemas/*_schemas.yml`, parameters in `parameters.yml`, response headers in `headers.yml`, responses in `responses.yml`, and examples in `examples.yml`. Operations reference them as they are added. Currently implemented: problem responses for errors of the Go public API and the ML service. Idempotency-Key storage, If-Match checks, and pagination are planned behavior for business operations; the declared `RegisterAccount` operation, the assessment commands, and `CreateOrganizationNeed` require Idempotency-Key, but no operation stores keys yet.
### Errors
@@ -81,7 +81,7 @@ Lists use cursor pagination: `limit` from 1 to 100 (20 by default) and an opaque
### Time and money
Timestamps use the `Timestamp` schema: `string`, `format: date-time`, UTC with the `Z` suffix (RFC 3339). Servers always emit UTC. ogen generates `Timestamp` as a named Go type over `time.Time`; call `.UTC()` where a value is converted to it. Money is planned as an integer number of whole rubles with explicit fields for the base, such as the pay period and gross or net; the schema is added with the first business field that carries money.
Timestamps use the `Timestamp` schema: `string`, `format: date-time`, UTC with the `Z` suffix (RFC 3339). Servers always emit UTC. ogen generates `Timestamp` as a named Go type over `time.Time`; call `.UTC()` where a value is converted to it. Money is an integer number of whole rubles (`RubAmount`, int64) with an explicit base: `SalaryRange` requires `salary_from`, `salary_to`, `currency` (`RUB`), `period` (`month`), and `tax_basis` (`net` or `gross`); see Needs below. Invitations are expected to reuse `SalaryRange`.
### ML service errors
@@ -237,6 +237,73 @@ Result:
Planned, additive: a short approach description of up to 1500 characters next to the practice, which never decides the grade (PRD FR05); the debug run operation of the practice; the notice and storage of the anti-cheat signals (time, focus changes, pastes, parallel sessions), which lead to a review and an appeal, never to a public label and never to the employer (PRD FR05).
### Needs
The `need` tag covers the hiring needs of an organization (PRD FR08, with the versions of FR10): requirements with their confirmation state and provenance, immutable versions, readiness, and category recommendations. The operations are in the contract; their business logic is not implemented yet, so every one answers 401 `unauthenticated` until sessions exist (`v1.DenyAllSecurity`).
| Method and path | operationId | Security | Success | Specific errors |
| --- | --- | --- | --- | --- |
| `GET /api/v1/organizations/{org_id}/needs` | `ListOrganizationNeeds` | session | 200 `NeedList`, `Cache-Control: no-store` | 400 `validation_failed`, 401, 403 `forbidden`, 404 `not_found` |
| `POST /api/v1/organizations/{org_id}/needs` | `CreateOrganizationNeed` | session and CSRF, Idempotency-Key | 201 `Need`, `Cache-Control: no-store` | 400, 401, 403 `csrf_check_failed` or `forbidden`, 404, 409 `idempotency_in_progress`, 422 `idempotency_key_reused`, 429 |
| `GET /api/v1/organizations/{org_id}/needs/{need_id}` | `GetOrganizationNeed` | session | 200 `Need`, `Cache-Control: no-store` | 400 `validation_failed`, 401, 403 `forbidden`, 404 `not_found` |
| `PATCH /api/v1/organizations/{org_id}/needs/{need_id}` | `UpdateOrganizationNeed` | session and CSRF | 200 `Need`, `Cache-Control: no-store` | 400, 401, 403, 404, 412 `version_conflict`, 429 |
Every operation also declares the `default` problem response. A malformed `org_id` or `need_id` answers 400 with the path pointer.
Access:
- `org_id` in the path is the only source of the organization, and the server checks it against the active membership of the session account; no request has an organization, membership, or role field. The organization contract (TASK-077) owns organizations and memberships and reuses the same path parameter, `parameters.yml#/OrganizationId`.
- An account without an active membership in `org_id`, an unknown organization, an unknown need, and a need of another organization all answer 404 `not_found`, so identifiers cannot be probed. A candidate account answers 403 `forbidden`, and so does a member whose role does not allow the operation.
- In the MVP only the owner of the organization works with needs. The other roles of the PRD FR07 matrix (recruiter, hiring manager and technical expert for assigned needs) are planned and change no field of the contract.
Fields and provenance:
- `requirements` (`NeedRequirementSet`) holds `specialization`, `grade`, `required_skills`, `desired_skills`, `tasks`, `domain`, `work_formats`, `location`, and `salary`. A field in a response is `{status, value, source}`; a list item has its own `status` and `source`.
- `status` is `confirmed` (a member entered or confirmed the value), `extracted` (a suggestion that waits for confirmation), or `unknown` (no value). An unknown field has null `value` and `source`; the server never fills it with a default or a guess such as Senior, remote, or a zero salary. Only confirmed values feed readiness, recommendations, search, and invitations.
- `source` has `origin` (`manual`, `extracted_from_text`, or the planned `imported`), `quote` (an exact excerpt of up to 300 characters, or null), `extracted_in_version`, and `extraction_version`. The quote is an excerpt of the `source_text` of `extracted_in_version`, not necessarily of the current text: a confirmed value keeps its quote after the text changes. Confirming a suggestion keeps its provenance; changing the value makes it `manual`.
- A skill has `taxonomy_code`. It is null for a skill that the platform taxonomy does not know: the name stays as given, no code is guessed, and recommendations count the skill as not covered.
- With `source_text`, the server extracts suggestions with deterministic rules and a dictionary before it answers, so needs work while ML is disabled. ML suggestions with quotes are planned as an asynchronous addition that creates a new version and never overwrites a confirmed value.
- The text is stored as written and may contain requirements that discriminate by a protected characteristic; the extractor never turns them into a need field. The field for what a candidate must not have, with the Labor Code article 64 check, is deferred to TASK-182 and will be added without a breaking change.
Requests, confirmation, and changes:
- Every requirement field in a request is a decision `{value, status}` (`NeedSpecializationInput`, `NeedGradeInput`, `NeedDomainInput`, `NeedWorkFormatsInput`, `NeedLocationInput`, `NeedSalaryInput`), and every list item is `{name or text, status}`. `status` is `confirmed` or `extracted`. A bare value fails validation, so confirmation is always explicit.
- `confirmed` with the stored suggested value confirms it and keeps its provenance; `confirmed` with another value sets a confirmed manual value. `extracted` keeps a stored suggestion open and is allowed only with exactly the stored suggested value; any other value, or a field or item without a suggestion, answers 400 with the pointer of that status, such as `/grade/status` or `/required_skills/2/status`. A client that sends back an unchanged form therefore confirms nothing by accident: it sends each suggestion with `extracted` or leaves the field out.
- A need never requires a vacancy: only `title` is required, and `vacancy_id` is optional and nullable. Until vacancies exist in the contract, any vacancy identifier answers 400 with the pointer `/vacancy_id`.
- On creation every decision must be `confirmed`, because a new need has no stored suggestion. An absent field is extracted from `source_text` or stays unknown. A nullable field sent as null stays unknown, and a skill or task list sent empty stays empty; neither is extracted. An empty `work_formats` value fails `minItems`.
- `UpdateOrganizationNeed` uses explicit field replacement in `application/json`, not JSON Merge Patch (RFC 7396): a present field replaces that field as a whole, an absent field stays unchanged, a decision and a list are never merged, and a stored item left out of a sent list is deleted. Null removes a nullable field (it becomes `unknown`, or `vacancy_id` is unlinked); an empty skill or task list deletes every item; a list sent as null answers 400. ogen generates one optional, or optional and nullable, value per decision (`OptNilNeedGradeInput`, `OptNilNeedSalaryInput`).
- A different `source_text` extracts again. New suggestions replace only the `extracted` values and items of fields not named in the body; confirmed values are never overwritten, a suggested skill whose name is already in either skill list is skipped, and a suggestion that a member deleted is not proposed again for this need.
- The server also rejects a repeated skill or task and a skill in both lists, with 400 and the pointer of the later item, such as `/required_skills/1/name`.
Versions and concurrency:
- `version` starts at 1 and advances by exactly one with each committed change, including server-side ones. Each version is an immutable snapshot. GET always returns the latest version.
- `requirements_version` is the version in which the confirmed requirements were last changed. Confirming, changing, or removing a requirement sets it to the new `version`; a change of the title, the vacancy link, the text, or suggestions only keeps it and invalidates neither the recommendations nor search results. Search runs, selection snapshots (FR10, TASK-193), and invitations refer to `(need_id, requirements_version)`, and only a new `requirements_version` calls for a new selection snapshot. Reading and comparing earlier versions are planned as separate operations that return `NeedRequirementSet` for a version; they add nothing to `Need`.
- A change carries `expected_version`, the version the client read, in the body for the same reason as the questionnaire: the generated client cannot read `ETag` yet. A stale value answers 412 `version_conflict` and changes nothing; TASK-179 says 409, but the repository rule keeps 412 for If-Match and a body version alike. A body that changes nothing answers 200 with the current need even with an older version, so PATCH needs no Idempotency-Key. POST needs one with the 24-hour replay; only the 201 is stored.
Readiness:
- `readiness.missing_fields` lists each critical field without a confirmed value: `specialization`, `grade`, `required_skills` (at least one confirmed skill), `work_formats`, `salary`, and `location` when the confirmed formats include `office` or `hybrid`. Each item has `reason` (`unknown` or `unconfirmed`) and a specific Russian `question`.
- An incomplete need is saved (201 or 200), not rejected. `Problem` allows no extension fields, so the missing fields live in the resource, not in a problem. Each later operation, such as search or an invitation, states which readiness it requires.
Salary:
- `SalaryRange` `[A; B]` has `salary_from` and `salary_to` (`RubAmount`, whole rubles), `currency` (`RUB` only), `period` (`month` only), and `tax_basis` (`net` or `gross`); every field is required. Requests send it as `salary: {value, status}`, so its pointers are under `/salary/value`.
- The schema requires bounds that are positive multiples of 1000 up to 100000000 and rejects another currency, period, or basis, for example with `/salary/value/tax_basis`. A missing field of the nested range has the whole-body pointer.
- The server checks the cross-field rules of PRD FR13 in integer arithmetic: `A < B` and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation, including equal bounds, answers 400 with the pointer `/salary/value/salary_to`. `[95000; 105000]` (exactly 10%) and `[80000; 120000]` (exactly 40%) are accepted. FR13 applies the same rules to the range of a need and of an invitation, and `docs/*/ARCHITECTURE.md` now states them for invitations instead of `0 < salary_from <= salary_to`.
- Limit against probing hidden minimums (FR13, planned in TASK-211): setting a confirmed range, on creation or on a change, counts against a counter shared by the whole organization, every member and every need, so a new need does not reset it. At most three range settings a day; over the limit the server answers 429 with Retry-After and changes nothing. After five settings within seven days the money component is `withheld` for seven days. Repeated range changes also feed the private risk signals of TASK-319.
Recommendations:
- `recommendations` is computed by the server from the confirmed requirements of `requirements_version` with a versioned policy (`policy_version`, `algorithm_version`, `computed_at`). `status` is `computed`, `pending`, or `not_available` without a confirmed skill. The server may recompute them for the same `requirements_version`, for a new policy or a changed pool of candidates, without a new need version; `computed_at` and `policy_version` then change.
- Each category (`specialization` and `grade`) has `score`, `skill_overlap` (weighted share with weight 2 for required and 1 for desired skills, covered and uncovered skills), `money`, and `supply` as a band: `fewer_than_5`, `from_5_to_29`, `30_or_more`. The list order is the ranking.
- `money.status` is `computed`, `insufficient_data` (fewer than five candidates with a comparable known minimum), `no_salary`, or `withheld`; the last three use the neutral 0.5 and a null share. `money.share` is rounded down to a quarter (0, 0.25, 0.5, 0.75, 1): each probe of a new upper bound then tells at most which quarter of the group accepts it, and in the smallest allowed group of five a single minimum often does not move the value, while the share still separates a range that most candidates accept from one that few accept.
- `score` is `0.5 * Overlap + 0.3 * Money + 0.2 * Supply`, rounded half up to two decimals, computed from the published components: the exact overlap, the quarter-rounded share or the neutral 0.5, and `Supply = min(1, active / 30)`. It is null when `supply` is `fewer_than_5`. The ranking uses Supply only at band precision below five: every group of fewer than five candidates enters it with Supply 0, so neither the score nor the order reveals the exact size of a group below five, which FR08 forbids. For five or more candidates the exact Supply is used, so the TASK-183 fixture (Overlap 1, Money 0.5, 15 active candidates) gives `score` 0.75.
- Deviation from the PRD formula and from TASK-183 and TASK-457: the money share in the score and ranking is the quarter-rounded share, not the exact one, and a category with fewer than five candidates has no score. Otherwise the score with the exact share would reveal the share that `money.share` rounds, and a score with the exact Supply of a small group would reveal its size. The breakdown that TASK-457 shows consists of the published components.
- Requests cannot set a recommendation, its score, membership, or a candidate minimum: bodies have `additionalProperties: false`, and unknown fields such as `rec_score`, `members`, `candidate_minimum`, `version`, `requirements_version`, or `recommendations` answer 400 with the whole-body pointer. `TestNeedSchemaValidationPrecedesImplementation` checks the schema rejections through the generated server, `TestNeedUpdateDecodingKeepsAbsentAndEmptyListsApart` checks the list decoding, and `frontend/src/shared/api/needs-contract.test.ts` pins the generated Zod limits, the explicit status of every decision, and the absence of these fields in the request types.
Planned, additive: reading and comparing versions, exclusions (TASK-182), the market range hint (P25-P75) of FR08, the check plan "vacancy -> tasks", a need status for archiving, list filters, and need assignments.
### Generator checks
`testdata/openapi-3.2.0.yml` contains test operations that use the components above: pagination, Idempotency-Key, If-Match, ETag, and problem responses. ogen does not resolve external references, so the fixture keeps copies of the api/core components; `scripts/test_contract_copies.py` (part of `make -C api check`) checks that they, the fixture responses, and the ML `Problem` copy match api/core.
@@ -262,12 +329,13 @@ Known generator limitations:
- ogen requires a `SecurityHandler` as soon as the contract has security schemes and evaluates the schemes in the order of their generated type names, so renaming a scheme can change the order; `TestGeneratedServerSecurityOrder` fails if it does. Security failures reach `NewError` without a response header, so clearing the cookie on a 401 from `Logout` needs handwritten code.
- Orval does not expose security scheme values as typed arguments, so `X-CSRF-Token` is not a generated parameter; the shared API client is planned to attach it to mutating requests. Orval also generates no type for `Set-Cookie`, which the browser handles.
- Orval Zod schemas ignore `uniqueItems` and do not reject unknown fields of `additionalProperties: false` objects; the server stays authoritative for both.
- ogen generates an optional nullable field as `OptNil<T>`, which tells absent (`IsSet` false), null (`IsNull`), and a value apart. An optional array that is not nullable is a plain slice instead, where nil and `[]` mean different things: an absent field decodes to nil (unchanged) and `[]` to an empty non-nil slice (delete every item), and null fails decoding. An `UpdateOrganizationNeed` handler must therefore test lists with `!= nil`, never with `len`; `TestNeedUpdateDecodingKeepsAbsentAndEmptyListsApart` pins this.
- Orval clears `src/shared/api/endpoints/` and `src/shared/api/schemas/` before generation (`clean: true`), because a schema used by several tags moves from a tag directory to the schema root.
#### Format unions
- Format unions such as `ItemContent` and `AssessmentAnswer` are `oneOf` without a `discriminator` object. Redocly resolves `discriminator.mapping` values as references, and `scripts/merge-schemas.py` rewrites only `$ref`, so a mapping in a split schema file cannot resolve in the merged `components/schemas.yml`. Every variant fixes `format` with a one-value enum; ogen discriminates by that value and by the fields unique to a variant and rejects a body that matches several variants, and Orval generates a Zod union.
- Orval names the constants of an inline property `<Schema><Property>`, so a property name that repeats another schema name collides in `index.ts` (TS2308). The union of item formats is therefore `ItemContent`, not `AssessmentItemContent`, next to the `AssessmentItem.content` property.
- Orval names the constants of an inline property `<Schema><Property>`, so a property name that repeats another schema name collides in `index.ts` (TS2308). The union of item formats is therefore `ItemContent`, not `AssessmentItemContent`, next to the `AssessmentItem.content` property, and the parts of `Need` are `NeedRequirementSet`, `NeedReadinessReport`, and `NeedCategoryRecommendations`, not `NeedRequirements`, `NeedReadiness`, and `NeedRecommendations`.
Generated Zod is not strict. A body that mixes the fields of two formats or carries an extra `score` or `seed` is accepted after unknown keys are silently stripped, and `uniqueItems` is not checked; only the server rejects such bodies. `frontend/src/shared/api/assessment-contract.test.ts` pins the accepted formats and that no answer or item DTO has a score, key, seed, or correctness field.
+71 -3
View File
@@ -14,7 +14,7 @@
## Соглашения контракта
`api/core/` закрепляет эти соглашения как переиспользуемые компоненты в `openapi.yml` и файлах `components/`: схемы в `components/schemas/*_schemas.yml`, параметры в `parameters.yml`, заголовки ответов в `headers.yml`, ответы в `responses.yml`, примеры в `examples.yml`. Операции ссылаются на них по мере появления. Сейчас реализованы problem-ответы для ошибок публичного Go API и ML-сервиса. Хранение Idempotency-Key, проверки If-Match и пагинация - запланированное поведение бизнес-операций; объявленная операция `RegisterAccount` и команды оценки требуют Idempotency-Key, но ни одна операция пока не хранит ключи.
`api/core/` закрепляет эти соглашения как переиспользуемые компоненты в `openapi.yml` и файлах `components/`: схемы в `components/schemas/*_schemas.yml`, параметры в `parameters.yml`, заголовки ответов в `headers.yml`, ответы в `responses.yml`, примеры в `examples.yml`. Операции ссылаются на них по мере появления. Сейчас реализованы problem-ответы для ошибок публичного Go API и ML-сервиса. Хранение Idempotency-Key, проверки If-Match и пагинация - запланированное поведение бизнес-операций; объявленная операция `RegisterAccount`, команды оценки и `CreateOrganizationNeed` требуют Idempotency-Key, но ни одна операция пока не хранит ключи.
### Ошибки
@@ -81,7 +81,7 @@
### Время и деньги
Метки времени используют схему `Timestamp`: `string`, `format: date-time`, UTC с суффиксом `Z` (RFC 3339). Серверы всегда отдают UTC. ogen генерирует `Timestamp` как именованный Go-тип поверх `time.Time`; при преобразовании к нему вызывайте `.UTC()`. Деньги запланированы как целое число полных рублей с явными полями базы, например периодом оплаты и gross или net; схема появится вместе с первым бизнес-полем с деньгами.
Метки времени используют схему `Timestamp`: `string`, `format: date-time`, UTC с суффиксом `Z` (RFC 3339). Серверы всегда отдают UTC. ogen генерирует `Timestamp` как именованный Go-тип поверх `time.Time`; при преобразовании к нему вызывайте `.UTC()`. Деньги - целое число полных рублей (`RubAmount`, int64) с явной базой: `SalaryRange` требует `salary_from`, `salary_to`, `currency` (`RUB`), `period` (`month`) и `tax_basis` (`net` или `gross`); см. раздел Потребности ниже. Приглашения, как ожидается, переиспользуют `SalaryRange`.
### Ошибки ML-сервиса
@@ -237,6 +237,73 @@ ML-сервис отвечает на ошибки той же схемой `Pro
Запланировано, добавляется без ломающих изменений: краткое описание подхода до 1500 знаков рядом с практикой, которое не определяет грейд (FR05 в PRD); операция отладочных запусков практики; уведомление о собираемых античит-сигналах (время, переключение фокуса, вставки, параллельные сессии) и их хранение; сигналы ведут к перепроверке и апелляции, а не к публичному ярлыку, и работодателю не показываются (FR05 в PRD).
### Потребности
Тег `need` описывает потребности организации в найме (FR08 в PRD, с версиями из FR10): требования с состоянием подтверждения и происхождением, неизменяемые версии, готовность и рекомендации категорий. Операции есть в контракте, бизнес-логика еще не реализована, поэтому каждая отвечает 401 `unauthenticated`, пока сессий нет (`v1.DenyAllSecurity`).
| Метод и путь | operationId | Защита | Успех | Конкретные ошибки |
| --- | --- | --- | --- | --- |
| `GET /api/v1/organizations/{org_id}/needs` | `ListOrganizationNeeds` | сессия | 200 `NeedList`, `Cache-Control: no-store` | 400 `validation_failed`, 401, 403 `forbidden`, 404 `not_found` |
| `POST /api/v1/organizations/{org_id}/needs` | `CreateOrganizationNeed` | сессия и CSRF, Idempotency-Key | 201 `Need`, `Cache-Control: no-store` | 400, 401, 403 `csrf_check_failed` или `forbidden`, 404, 409 `idempotency_in_progress`, 422 `idempotency_key_reused`, 429 |
| `GET /api/v1/organizations/{org_id}/needs/{need_id}` | `GetOrganizationNeed` | сессия | 200 `Need`, `Cache-Control: no-store` | 400 `validation_failed`, 401, 403 `forbidden`, 404 `not_found` |
| `PATCH /api/v1/organizations/{org_id}/needs/{need_id}` | `UpdateOrganizationNeed` | сессия и CSRF | 200 `Need`, `Cache-Control: no-store` | 400, 401, 403, 404, 412 `version_conflict`, 429 |
Каждая операция также объявляет problem-ответ `default`. Некорректные `org_id` или `need_id` дают 400 с pointer на параметр пути.
Доступ:
- `org_id` в пути - единственный источник организации, и сервер сверяет его с действующим членством аккаунта сессии; ни один запрос не содержит поля организации, членства или роли. Организации и членства принадлежат контракту организации (TASK-077), который переиспользует тот же параметр пути `parameters.yml#/OrganizationId`.
- Аккаунт без действующего членства в `org_id`, неизвестная организация, неизвестная потребность и потребность другой организации одинаково дают 404 `not_found`, поэтому идентификаторы нельзя перебрать. Аккаунт кандидата получает 403 `forbidden`, как и участник, чья роль не разрешает операцию.
- В MVP с потребностями работает только владелец организации. Остальные роли матрицы FR07 в PRD (рекрутер, нанимающий менеджер и техэксперт для назначенных потребностей) запланированы и не меняют ни одного поля контракта.
Поля и происхождение:
- `requirements` (`NeedRequirementSet`) содержит `specialization`, `grade`, `required_skills`, `desired_skills`, `tasks`, `domain`, `work_formats`, `location` и `salary`. Поле в ответе - это `{status, value, source}`; у элемента списка свои `status` и `source`.
- `status` - `confirmed` (участник ввел или подтвердил значение), `extracted` (предложение, ожидающее подтверждения) или `unknown` (значения нет). У неизвестного поля `value` и `source` равны null; сервер никогда не заполняет его значением по умолчанию или догадкой, например Senior, remote или нулевой зарплатой. Только подтвержденные значения влияют на готовность, рекомендации, поиск и приглашения.
- `source` содержит `origin` (`manual`, `extracted_from_text` или запланированный `imported`), `quote` (точный фрагмент до 300 знаков или null), `extracted_in_version` и `extraction_version`. Цитата - фрагмент `source_text` версии `extracted_in_version`, а не обязательно текущего текста: подтвержденное значение сохраняет цитату после изменения текста. Подтверждение предложения сохраняет его происхождение; изменение значения делает его `manual`.
- У навыка есть `taxonomy_code`. Он равен null для навыка, которого нет в таксономии платформы: название остается как указано, код не угадывается, а рекомендации считают навык непокрытым.
- При наличии `source_text` сервер до ответа извлекает предложения детерминированными правилами и словарем, поэтому потребности работают при выключенном ML. ML-предложения с цитатами запланированы как асинхронное дополнение, которое создает новую версию и никогда не перезаписывает подтвержденное значение.
- Текст хранится как написан и может содержать дискриминирующие требования по защищенным признакам; извлечение никогда не превращает их в поле потребности. Поле того, чего не должно быть у кандидата, с проверкой по ст. 64 ТК РФ отложено до TASK-182 и добавится без ломающих изменений.
Запросы, подтверждение и изменения:
- Каждое поле требования в запросе - это решение `{value, status}` (`NeedSpecializationInput`, `NeedGradeInput`, `NeedDomainInput`, `NeedWorkFormatsInput`, `NeedLocationInput`, `NeedSalaryInput`), а каждый элемент списка - `{name или text, status}`. `status` - `confirmed` или `extracted`. Голое значение не проходит валидацию, поэтому подтверждение всегда явное.
- `confirmed` с сохраненным предложенным значением подтверждает его и сохраняет происхождение; `confirmed` с другим значением задает подтвержденное ручное значение. `extracted` оставляет сохраненное предложение открытым и допустим только с точно тем же предложенным значением; любое другое значение, а также поле или элемент без предложения дают 400 с pointer на этот статус, например `/grade/status` или `/required_skills/2/status`. Поэтому клиент, отправивший форму без изменений, ничего не подтверждает случайно: каждое предложение он отправляет с `extracted` или не отправляет поле.
- Потребности никогда не нужна вакансия: обязателен только `title`, а `vacancy_id` необязателен и допускает null. Пока вакансий нет в контракте, любой идентификатор вакансии дает 400 с pointer `/vacancy_id`.
- При создании каждое решение должно быть `confirmed`, потому что у новой потребности нет сохраненных предложений. Отсутствующее поле извлекается из `source_text` или остается неизвестным. Nullable-поле, переданное как null, остается неизвестным, а пустой список навыков или задач остается пустым; ни то ни другое не извлекается. Пустое значение `work_formats` не проходит `minItems`.
- `UpdateOrganizationNeed` использует явную замену полей в `application/json`, а не JSON Merge Patch (RFC 7396): переданное поле заменяется целиком, отсутствующее не меняется, решения и списки не сливаются, а сохраненный элемент, которого нет в переданном списке, удаляется. Null удаляет nullable-поле (оно становится `unknown`, а `vacancy_id` отвязывается); пустой список навыков или задач удаляет все элементы; список, переданный как null, дает 400. ogen генерирует одно необязательное или необязательное nullable значение на решение (`OptNilNeedGradeInput`, `OptNilNeedSalaryInput`).
- Другой `source_text` запускает повторное извлечение. Новые предложения заменяют только значения и элементы со статусом `extracted` в полях, не названных в теле; подтвержденные значения не перезаписываются, предложенный навык с названием, которое уже есть в одном из списков навыков, пропускается, а удаленное участником предложение для этой потребности больше не предлагается.
- Сервер также отклоняет повтор навыка или задачи и навык в обоих списках - 400 с pointer на более поздний элемент, например `/required_skills/1/name`.
Версии и конкурентность:
- `version` начинается с 1 и растет ровно на единицу с каждым зафиксированным изменением, включая серверные. Каждая версия - неизменяемый снимок. GET всегда возвращает последнюю версию.
- `requirements_version` - версия, в которой подтвержденные требования менялись последний раз. Подтверждение, изменение или удаление требования делает ее равной новой `version`; изменение названия, привязки вакансии, текста или только предложений ее сохраняет и не обесценивает ни рекомендации, ни результаты поиска. Запуски поиска, снимки подборки (FR10, TASK-193) и приглашения ссылаются на `(need_id, requirements_version)`, и новый снимок подборки нужен только при новой `requirements_version`. Чтение и сравнение прежних версий запланированы отдельными операциями, которые возвращают `NeedRequirementSet` для версии; в `Need` они ничего не добавляют.
- Изменение передает `expected_version` - прочитанную клиентом версию - в теле по той же причине, что и анкета: сгенерированный клиент пока не читает `ETag`. Устаревшее значение дает 412 `version_conflict` и ничего не меняет; в TASK-179 указан 409, но правило репозитория сохраняет 412 и для If-Match, и для версии в теле. Тело, которое ничего не меняет, дает 200 с текущей потребностью даже со старой версией, поэтому PATCH не нужен Idempotency-Key. POST требует его с повтором в течение 24 часов; сохраняется только 201.
Готовность:
- `readiness.missing_fields` перечисляет каждое критичное поле без подтвержденного значения: `specialization`, `grade`, `required_skills` (хотя бы один подтвержденный навык), `work_formats`, `salary` и `location`, если подтвержденные форматы включают `office` или `hybrid`. У каждого элемента есть `reason` (`unknown` или `unconfirmed`) и конкретный вопрос `question` на русском.
- Неполная потребность сохраняется (201 или 200), а не отклоняется. `Problem` не допускает полей расширения, поэтому недостающие поля находятся в ресурсе, а не в problem. Каждая следующая операция, например поиск или приглашение, сама указывает, какая готовность ей нужна.
Зарплата:
- `SalaryRange` `[A; B]` содержит `salary_from` и `salary_to` (`RubAmount`, целые рубли), `currency` (только `RUB`), `period` (только `month`) и `tax_basis` (`net` или `gross`); все поля обязательны. Запрос передает ее как `salary: {value, status}`, поэтому ее pointer начинаются с `/salary/value`.
- Схема требует положительных границ, кратных 1000, до 100000000 и отклоняет другую валюту, период или базу, например с `/salary/value/tax_basis`. Для отсутствующего поля вложенной вилки pointer указывает на все тело.
- Межполевые правила FR13 в PRD сервер проверяет в целочисленной арифметике: `A < B` и ширина `(B - A) / ((A + B) / 2)` от 10% до 40% включительно, то есть `20 * (B - A) >= A + B` и `5 * (B - A) <= A + B`. Нарушение, включая равные границы, дает 400 с pointer `/salary/value/salary_to`. `[95000; 105000]` (ровно 10%) и `[80000; 120000]` (ровно 40%) принимаются. FR13 применяет одни правила к вилке потребности и приглашения, и `docs/*/ARCHITECTURE.md` теперь указывает их для приглашений вместо `0 < salary_from <= salary_to`.
- Ограничение против подбора скрытых минимумов (FR13, запланировано в TASK-211): задание подтвержденной вилки при создании или изменении учитывается в счетчике, общем для всей организации, всех участников и всех потребностей, поэтому новая потребность его не обнуляет. Не больше трех заданий вилки в сутки; сверх лимита сервер отвечает 429 с Retry-After и ничего не меняет. После пяти заданий за семь дней денежная компонента получает статус `withheld` на семь дней. Повторные изменения вилки также питают приватные сигналы риска TASK-319.
Рекомендации:
- `recommendations` вычисляет сервер по подтвержденным требованиям версии `requirements_version` с версионируемой политикой (`policy_version`, `algorithm_version`, `computed_at`). `status` - `computed`, `pending` или `not_available` без подтвержденного навыка. Сервер может пересчитать их для той же `requirements_version` при новой политике или изменившемся пуле кандидатов без новой версии потребности; тогда меняются `computed_at` и `policy_version`.
- У каждой категории (`specialization` и `grade`) есть `score`, `skill_overlap` (взвешенная доля с весом 2 для обязательных и 1 для желательных навыков, покрытые и непокрытые навыки), `money` и `supply` диапазоном: `fewer_than_5`, `from_5_to_29`, `30_or_more`. Порядок списка задает ранжирование.
- `money.status` - `computed`, `insufficient_data` (меньше пяти кандидатов с известным сопоставимым минимумом), `no_salary` или `withheld`; последние три используют нейтральное 0,5 и null в доле. `money.share` округляется вниз до четверти (0, 0.25, 0.5, 0.75, 1): каждая проба новой верхней границы говорит не больше того, какая четверть группы ее принимает, а в наименьшей допустимой группе из пяти один минимум часто не сдвигает значение; при этом доля по-прежнему отличает вилку, которую принимает большинство, от той, которую принимают немногие.
- `score` равен `0.5 * Overlap + 0.3 * Money + 0.2 * Supply` с округлением половины вверх до двух знаков и вычисляется по опубликованным компонентам: точному покрытию, доле с округлением до четверти или нейтральному 0,5 и `Supply = min(1, active / 30)`. Он равен null, когда `supply` - `fewer_than_5`. Ниже пяти ранжирование использует Supply только с точностью диапазона: каждая группа меньше пяти кандидатов входит в него с Supply 0, поэтому ни балл, ни порядок не раскрывают точный размер группы меньше пяти, что запрещает FR08. Для пяти и более кандидатов используется точный Supply, поэтому фикстура TASK-183 (Overlap 1, Money 0,5, 15 активных кандидатов) дает `score` 0.75.
- Отступление от формулы PRD, TASK-183 и TASK-457: в балле и ранжировании используется доля денег, округленная до четверти, а не точная, и у категории меньше чем с пятью кандидатами балла нет. Иначе балл с точной долей раскрыл бы долю, которую округляет `money.share`, а балл с точным Supply малой группы - ее размер. Разложение, которое показывает TASK-457, состоит из опубликованных компонент.
- Запрос не может задать рекомендацию, ее балл, членство или минимум кандидата: у тел `additionalProperties: false`, и неизвестные поля, например `rec_score`, `members`, `candidate_minimum`, `version`, `requirements_version` или `recommendations`, дают 400 с pointer на все тело. `TestNeedSchemaValidationPrecedesImplementation` проверяет отказы схемы через сгенерированный сервер, `TestNeedUpdateDecodingKeepsAbsentAndEmptyListsApart` - декодирование списков, а `frontend/src/shared/api/needs-contract.test.ts` закрепляет ограничения сгенерированного Zod, явный статус каждого решения и отсутствие этих полей в типах запросов.
Запланировано, добавляется без ломающих изменений: чтение и сравнение версий, исключения (TASK-182), подсказка рыночной вилки (P25-P75) из FR08, план проверки "вакансия -> задания", статус потребности для архивации, фильтры списка и назначения на потребность.
### Проверки генераторов
`testdata/openapi-3.2.0.yml` содержит тестовые операции с перечисленными компонентами: пагинацией, Idempotency-Key, If-Match, ETag и problem-ответами. ogen не разрешает внешние ссылки, поэтому фикстура хранит копии компонентов api/core; `scripts/test_contract_copies.py` (входит в `make -C api check`) проверяет, что они, ответы фикстуры и ML-копия `Problem` совпадают с api/core.
@@ -262,12 +329,13 @@ ML-сервис отвечает на ошибки той же схемой `Pro
- ogen требует `SecurityHandler`, как только в контракте есть схемы защиты, и проверяет схемы в порядке имен их сгенерированных типов, поэтому переименование схемы может изменить порядок; тогда `TestGeneratedServerSecurityOrder` упадет. Сбои защиты попадают в `NewError` без заголовков ответа, поэтому удаление cookie при 401 от `Logout` требует ручного кода.
- Orval не делает значения схем защиты типизированными аргументами, поэтому `X-CSRF-Token` не является сгенерированным параметром; его планируется добавлять к изменяющим запросам в общем API-клиенте. Тип для `Set-Cookie` Orval тоже не генерирует, этот заголовок обрабатывает браузер.
- Zod-схемы Orval игнорируют `uniqueItems` и не отклоняют неизвестные поля объектов с `additionalProperties: false`; в обоих случаях решает сервер.
- ogen генерирует необязательное nullable-поле как `OptNil<T>`, которое различает отсутствие (`IsSet` false), null (`IsNull`) и значение. Необязательный массив без null, напротив, - обычный slice, где nil и `[]` значат разное: отсутствующее поле декодируется в nil (без изменений), `[]` - в пустой slice, не равный nil (удалить все элементы), а null не декодируется. Поэтому обработчик `UpdateOrganizationNeed` должен проверять списки через `!= nil`, а не через `len`; это закрепляет `TestNeedUpdateDecodingKeepsAbsentAndEmptyListsApart`.
- Orval очищает `src/shared/api/endpoints/` и `src/shared/api/schemas/` перед генерацией (`clean: true`), потому что схема, используемая несколькими тегами, переезжает из каталога тега в корень схем.
#### Объединения форматов
- Объединения форматов, например `ItemContent` и `AssessmentAnswer`, - это `oneOf` без объекта `discriminator`. Redocly разрешает значения `discriminator.mapping` как ссылки, а `scripts/merge-schemas.py` переписывает только `$ref`, поэтому mapping из отдельного файла схем не разрешается в объединенном `components/schemas.yml`. Каждый вариант фиксирует `format` перечислением из одного значения; ogen различает варианты по этому значению и по полям, уникальным для варианта, и отклоняет тело, подходящее под несколько вариантов, а Orval генерирует Zod-объединение.
- Orval называет константы встроенного свойства `<Schema><Property>`, поэтому имя свойства, повторяющее имя другой схемы, дает конфликт в `index.ts` (TS2308). Поэтому объединение форматов задания называется `ItemContent`, а не `AssessmentItemContent`, рядом со свойством `AssessmentItem.content`.
- Orval называет константы встроенного свойства `<Schema><Property>`, поэтому имя свойства, повторяющее имя другой схемы, дает конфликт в `index.ts` (TS2308). Поэтому объединение форматов задания называется `ItemContent`, а не `AssessmentItemContent`, рядом со свойством `AssessmentItem.content`, а части `Need` называются `NeedRequirementSet`, `NeedReadinessReport` и `NeedCategoryRecommendations`, а не `NeedRequirements`, `NeedReadiness` и `NeedRecommendations`.
Сгенерированный Zod не строгий. Тело, смешивающее поля двух форматов или содержащее лишние `score` или `seed`, принимается после молчаливого удаления неизвестных ключей, а `uniqueItems` не проверяется; такие тела отклоняет только сервер. `frontend/src/shared/api/assessment-contract.test.ts` закрепляет принимаемые форматы и отсутствие в DTO ответа и задания полей балла, ключа, seed или правильности.
+674
View File
@@ -1341,3 +1341,677 @@ AssessmentStaleVersion:
code: version_conflict
detail: The resource changed after it was read. Read it again before retrying.
trace_id: 5f6a7b8c-9d0e-4f1a-8b2c-3d4e5f6a7b8c
NeedCreateManual:
summary: A manual need without a vacancy and without a text
description: Every field comes from the form as a decision with status confirmed, so every value is a confirmed manual value. There is no vacancy_id and no source_text; the domain is not given and stays unknown.
value:
title: Junior Go-разработчик для сервиса уведомлений
specialization:
value: backend
status: confirmed
grade:
value: junior
status: confirmed
required_skills:
- name: Go
status: confirmed
- name: PostgreSQL
status: confirmed
desired_skills:
- name: Docker
status: confirmed
tasks:
- text: Поддерживать и развивать сервис уведомлений
status: confirmed
work_formats:
value:
- hybrid
status: confirmed
location:
value: Москва
status: confirmed
salary:
value:
salary_from: 120000
salary_to: 160000
currency: RUB
period: month
tax_basis: net
status: confirmed
NeedCreateFromText:
summary: A need created from a pasted description
description: Only the title and the text are given. The server extracts suggestions from the text; nothing is confirmed until a member confirms it.
value:
title: Backend в команду платежей
source_text: "Ищем бэкенд-разработчика в команду платежей. Обязательно: Go, PostgreSQL и Temporal. Желательно опыт с Kafka. Задачи: развивать сервис выплат и переводить его на событийную модель. Работа удаленно."
NeedManualWithoutVacancy:
summary: A complete manual need without a vacancy, with computed recommendations
description: The need created by NeedCreateManual. Every value is confirmed and manual, so the quote, extracted_in_version, and extraction_version are null; the domain was not given and stays unknown with null value and source rather than a guessed one. The hybrid format makes the location critical, and it is confirmed. The range of 120000-160000 has a width of about 29%. The first category scores 0.75 with Overlap 1, a money share rounded down to 0.5, and Supply 0.5 for 15 available candidates. The other two have fewer than five candidates, so their score is null and Supply enters their ranking as 0. The recommendation values are illustrative and say nothing about a deployed policy or real candidates.
value:
id: 01928f7a-2b3c-7d4e-9f5a-6b7c8d9e0f12
organization_id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
vacancy_id: null
title: Junior Go-разработчик для сервиса уведомлений
source_text: null
version: 1
requirements_version: 1
requirements:
specialization:
status: confirmed
value: backend
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
grade:
status: confirmed
value: junior
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
required_skills:
- name: Go
taxonomy_code: go
status: confirmed
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
- name: PostgreSQL
taxonomy_code: postgresql
status: confirmed
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
desired_skills:
- name: Docker
taxonomy_code: docker
status: confirmed
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
tasks:
- text: Поддерживать и развивать сервис уведомлений
status: confirmed
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
domain:
status: unknown
value: null
source: null
work_formats:
status: confirmed
value:
- hybrid
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
location:
status: confirmed
value: Москва
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
salary:
status: confirmed
value:
salary_from: 120000
salary_to: 160000
currency: RUB
period: month
tax_basis: net
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
readiness:
status: complete
missing_fields: []
recommendations:
status: computed
requirements_version: 1
policy_version: 1
algorithm_version: need-rec.2026-10.1
computed_at: "2026-10-06T08:15:02Z"
categories:
- specialization: backend
grade: junior
score: 0.75
skill_overlap:
share: 1
covered_skills:
- Go
- PostgreSQL
- Docker
uncovered_skills: []
money:
status: computed
share: 0.5
supply: from_5_to_29
- specialization: backend
grade: intern
score: null
skill_overlap:
share: 0.8
covered_skills:
- Go
- PostgreSQL
uncovered_skills:
- Docker
money:
status: insufficient_data
share: null
supply: fewer_than_5
- specialization: devops_sre
grade: junior
score: null
skill_overlap:
share: 0.2
covered_skills:
- Docker
uncovered_skills:
- Go
- PostgreSQL
money:
status: insufficient_data
share: null
supply: fewer_than_5
created_at: "2026-10-06T08:15:00Z"
updated_at: "2026-10-06T08:15:00Z"
NeedExtractedWithUnknownSkill:
summary: A need from text with suggestions, an unknown skill, and missing fields
description: "The need created by NeedCreateFromText. Every value found in the text is extracted with its quote from the text of version 1 and the extractor version, and waits for confirmation. Temporal is not in the skill taxonomy, so its taxonomy_code is null instead of a guessed code. The text names no grade, place, or salary: they stay unknown with null value and source, and the critical ones are listed in missing_fields with a question. Without a confirmed skill there are no recommendations yet."
value:
id: 01928f7a-3c4d-7e5f-8a6b-7c8d9e0f1a23
organization_id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
vacancy_id: null
title: Backend в команду платежей
source_text: "Ищем бэкенд-разработчика в команду платежей. Обязательно: Go, PostgreSQL и Temporal. Желательно опыт с Kafka. Задачи: развивать сервис выплат и переводить его на событийную модель. Работа удаленно."
version: 1
requirements_version: 1
requirements:
specialization:
status: extracted
value: backend
source:
origin: extracted_from_text
quote: Ищем бэкенд-разработчика
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
grade:
status: unknown
value: null
source: null
required_skills:
- name: Go
taxonomy_code: go
status: extracted
source:
origin: extracted_from_text
quote: "Обязательно: Go, PostgreSQL и Temporal"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
- name: PostgreSQL
taxonomy_code: postgresql
status: extracted
source:
origin: extracted_from_text
quote: "Обязательно: Go, PostgreSQL и Temporal"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
- name: Temporal
taxonomy_code: null
status: extracted
source:
origin: extracted_from_text
quote: "Обязательно: Go, PostgreSQL и Temporal"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
desired_skills:
- name: Kafka
taxonomy_code: kafka
status: extracted
source:
origin: extracted_from_text
quote: Желательно опыт с Kafka
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
tasks:
- text: Развивать сервис выплат и переводить его на событийную модель
status: extracted
source:
origin: extracted_from_text
quote: "Задачи: развивать сервис выплат и переводить его на событийную модель"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
domain:
status: extracted
value: платежи
source:
origin: extracted_from_text
quote: в команду платежей
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
work_formats:
status: extracted
value:
- remote
source:
origin: extracted_from_text
quote: Работа удаленно
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
location:
status: unknown
value: null
source: null
salary:
status: unknown
value: null
source: null
readiness:
status: incomplete
missing_fields:
- field: specialization
reason: unconfirmed
question: Подтвердите специализацию, найденную в описании.
- field: grade
reason: unknown
question: "Какой грейд нужен: Intern, Junior, Middle или Senior?"
- field: required_skills
reason: unconfirmed
question: Подтвердите обязательные навыки, найденные в описании.
- field: work_formats
reason: unconfirmed
question: Подтвердите формат работы, найденный в описании.
- field: salary
reason: unknown
question: "Какую вилку в рублях вы предлагаете и в какой базе: на руки или до вычета НДФЛ?"
recommendations:
status: not_available
requirements_version: 1
policy_version: null
algorithm_version: null
computed_at: null
categories: []
created_at: "2026-10-06T09:00:00Z"
updated_at: "2026-10-06T09:00:00Z"
NeedUpdateConfirmSuggestions:
summary: Confirm suggestions, answer the missing fields, and keep two suggestions open
description: Sent over version 1 of NeedExtractedWithUnknownSkill. The specialization, the required skills, and the work format are sent with their stored values and status confirmed, so they are confirmed and keep their quotes. The grade and the salary are new manual values. Kafka and the domain are sent with status extracted and their stored values, so they stay open suggestions. The tasks are absent and stay unchanged.
value:
expected_version: 1
specialization:
value: backend
status: confirmed
grade:
value: middle
status: confirmed
required_skills:
- name: Go
status: confirmed
- name: PostgreSQL
status: confirmed
- name: Temporal
status: confirmed
desired_skills:
- name: Kafka
status: extracted
domain:
value: платежи
status: extracted
work_formats:
value:
- remote
status: confirmed
salary:
value:
salary_from: 250000
salary_to: 320000
currency: RUB
period: month
tax_basis: gross
status: confirmed
NeedConfirmedAfterUpdate:
summary: The need after the confirmation, as version 2
description: Confirmed suggestions keep the origin extracted_from_text, their quotes, and extracted_in_version 1; the grade and the salary are manual. A confirmed requirement changed, so requirements_version is 2 as well. Kafka and the domain are still open suggestions; Kafka does not count in the recommendations, and Temporal stays without a taxonomy code, so no category covers it. The place is unknown but not critical, because the only format is remote. The range of 250000-320000 has a width of about 25%. Scores use the overlap 4/6, the money share rounded down to a quarter or the neutral 0.5, and the exact Supply of groups of five or more. The recommendation values are illustrative.
value:
id: 01928f7a-3c4d-7e5f-8a6b-7c8d9e0f1a23
organization_id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
vacancy_id: null
title: Backend в команду платежей
source_text: "Ищем бэкенд-разработчика в команду платежей. Обязательно: Go, PostgreSQL и Temporal. Желательно опыт с Kafka. Задачи: развивать сервис выплат и переводить его на событийную модель. Работа удаленно."
version: 2
requirements_version: 2
requirements:
specialization:
status: confirmed
value: backend
source:
origin: extracted_from_text
quote: Ищем бэкенд-разработчика
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
grade:
status: confirmed
value: middle
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
required_skills:
- name: Go
taxonomy_code: go
status: confirmed
source:
origin: extracted_from_text
quote: "Обязательно: Go, PostgreSQL и Temporal"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
- name: PostgreSQL
taxonomy_code: postgresql
status: confirmed
source:
origin: extracted_from_text
quote: "Обязательно: Go, PostgreSQL и Temporal"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
- name: Temporal
taxonomy_code: null
status: confirmed
source:
origin: extracted_from_text
quote: "Обязательно: Go, PostgreSQL и Temporal"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
desired_skills:
- name: Kafka
taxonomy_code: kafka
status: extracted
source:
origin: extracted_from_text
quote: Желательно опыт с Kafka
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
tasks:
- text: Развивать сервис выплат и переводить его на событийную модель
status: extracted
source:
origin: extracted_from_text
quote: "Задачи: развивать сервис выплат и переводить его на событийную модель"
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
domain:
status: extracted
value: платежи
source:
origin: extracted_from_text
quote: в команду платежей
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
work_formats:
status: confirmed
value:
- remote
source:
origin: extracted_from_text
quote: Работа удаленно
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
location:
status: unknown
value: null
source: null
salary:
status: confirmed
value:
salary_from: 250000
salary_to: 320000
currency: RUB
period: month
tax_basis: gross
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
readiness:
status: complete
missing_fields: []
recommendations:
status: computed
requirements_version: 2
policy_version: 1
algorithm_version: need-rec.2026-10.1
computed_at: "2026-10-06T09:20:01Z"
categories:
- specialization: backend
grade: middle
score: 0.61
skill_overlap:
share: 0.67
covered_skills:
- Go
- PostgreSQL
uncovered_skills:
- Temporal
money:
status: computed
share: 0.25
supply: 30_or_more
- specialization: devops_sre
grade: middle
score: 0.45
skill_overlap:
share: 0.33
covered_skills:
- PostgreSQL
uncovered_skills:
- Go
- Temporal
money:
status: insufficient_data
share: null
supply: from_5_to_29
- specialization: backend
grade: senior
score: 0.41
skill_overlap:
share: 0.67
covered_skills:
- Go
- PostgreSQL
uncovered_skills:
- Temporal
money:
status: computed
share: 0
supply: from_5_to_29
created_at: "2026-10-06T09:00:00Z"
updated_at: "2026-10-06T09:20:00Z"
NeedListPage:
summary: The last page of the needs of an organization
value:
items:
- id: 01928f7a-3c4d-7e5f-8a6b-7c8d9e0f1a23
vacancy_id: null
title: Backend в команду платежей
version: 2
specialization:
status: confirmed
value: backend
source:
origin: extracted_from_text
quote: Ищем бэкенд-разработчика
extracted_in_version: 1
extraction_version: need-rules.2026-10.1
grade:
status: confirmed
value: middle
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
readiness:
status: complete
missing_fields: []
created_at: "2026-10-06T09:00:00Z"
updated_at: "2026-10-06T09:20:00Z"
- id: 01928f7a-2b3c-7d4e-9f5a-6b7c8d9e0f12
vacancy_id: null
title: Junior Go-разработчик для сервиса уведомлений
version: 1
specialization:
status: confirmed
value: backend
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
grade:
status: confirmed
value: junior
source:
origin: manual
quote: null
extracted_in_version: null
extraction_version: null
readiness:
status: complete
missing_fields: []
created_at: "2026-10-06T08:15:00Z"
updated_at: "2026-10-06T08:15:00Z"
page:
has_more: false
next_cursor: null
NeedSalaryRangeReversed:
summary: The lower salary bound is above the upper one
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 6b7c8d9e-0f1a-4b2c-8d3e-4f5a6b7c8d9f
errors:
- in: body
pointer: /salary/value/salary_to
code: invalid
message: The value does not match the contract.
NeedSalaryEqualBounds:
summary: Equal salary bounds; PRD FR13 requires salary_from < salary_to
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
errors:
- in: body
pointer: /salary/value/salary_to
code: invalid
message: The value does not match the contract.
NeedSalaryRangeTooWide:
summary: A salary range wider than 40% of its midpoint, such as 100000-200000
description: The width (200000 - 100000) / 150000 is about 67%. A range narrower than 10%, such as 100000-105000, gets the same answer.
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e
errors:
- in: body
pointer: /salary/value/salary_to
code: invalid
message: The value does not match the contract.
NeedSalaryWithoutTaxBasis:
summary: A salary range without its tax basis
description: The decoder does not record the path of a missing field in a nested object, so the pointer is the whole body.
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 7c8d9e0f-1a2b-4c3d-9e4f-5a6b7c8d9e0a
errors:
- in: body
pointer: ""
code: invalid
message: The value does not match the contract.
NeedExtractedValueMismatch:
summary: Status extracted with a value that is not the stored suggestion
description: A request may keep only the stored suggestion unconfirmed. To set another value, it sends status confirmed.
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 3c4d5e6f-7a8b-4c9d-8e0f-2a3b4c5d6e7f
errors:
- in: body
pointer: /grade/status
code: invalid
message: The value does not match the contract.
NeedUnknownField:
summary: The client sent its own recommendation score
description: Recommendations, membership, and candidate minimums are never request fields; any unknown field fails validation.
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 8d9e0f1a-2b3c-4d4e-8f5a-6b7c8d9e0f1b
errors:
- in: body
pointer: ""
code: invalid
message: The value does not match the contract.
NeedMissingExpectedVersion:
summary: A change without expected_version
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 9e0f1a2b-3c4d-4e5f-9a6b-7c8d9e0f1a2c
errors:
- in: body
pointer: /expected_version
code: required
message: The value is required.
NeedStaleVersion:
summary: The change carried a stale expected_version
description: Another member or a server-side extraction changed the need after the client read it. Nothing was changed; the client reads the need again and reapplies its unsaved edits.
value:
type: urn:lincodex:problem:version_conflict
title: Resource version conflict
status: 412
code: version_conflict
detail: The resource changed after it was read. Read it again before retrying.
trace_id: 0f1a2b3c-4d5e-4f6a-8b7c-8d9e0f1a2b3d
+25
View File
@@ -68,3 +68,28 @@ AssessmentAttemptId:
type: string
format: uuid
example: 01928f7a-3c4d-7e5f-8a9b-0c1d2e3f4a5b
OrganizationId:
name: org_id
in: path
required: true
description: >-
Identifier of an organization. Access comes only from an active
membership of the session account in this organization, checked by the
server on every request; the identifier itself grants nothing. An
organization without such a membership and an unknown identifier both
answer 404 not_found, so organizations cannot be enumerated.
schema:
type: string
format: uuid
example: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
NeedId:
name: need_id
in: path
required: true
description: >-
Identifier of a need of the organization in the path. A need of another
organization and an unknown identifier both answer 404 not_found.
schema:
type: string
format: uuid
example: 01928f7a-2b3c-7d4e-9f5a-6b7c8d9e0f12
+45
View File
@@ -374,3 +374,48 @@ AssessmentVersionConflict:
examples:
version_conflict:
$ref: ./examples.yml#/AssessmentStaleVersion
NeedValidationFailed:
description: >-
The body does not match the contract or violates a need rule: an unknown
field such as rec_score, members, or candidate_minimum, a field sent as a
bare value instead of `{value, status}`, a list sent as null, an unknown
specialization, grade, work format, currency, period, or tax basis, a
salary bound that is not a positive multiple of 1000, a lower bound that
is not below the upper one, a range width outside 10-40% of its midpoint,
a repeated skill or task, status `extracted` with a value that is not the
stored suggestion, a vacancy that is not a vacancy of the organization,
or a missing or invalid expected_version; code validation_failed with
body pointers. When the decoder does not record the path of a nested
field, the pointer is the whole body. Nothing was changed, and the
outcome is not stored under an Idempotency-Key.
content:
application/problem+json:
schema:
$ref: ./schemas.yml#/Problem
examples:
reversed_salary_range:
$ref: ./examples.yml#/NeedSalaryRangeReversed
equal_salary_bounds:
$ref: ./examples.yml#/NeedSalaryEqualBounds
salary_range_too_wide:
$ref: ./examples.yml#/NeedSalaryRangeTooWide
salary_without_tax_basis:
$ref: ./examples.yml#/NeedSalaryWithoutTaxBasis
extracted_value_mismatch:
$ref: ./examples.yml#/NeedExtractedValueMismatch
recommendation_score_sent_by_client:
$ref: ./examples.yml#/NeedUnknownField
missing_expected_version:
$ref: ./examples.yml#/NeedMissingExpectedVersion
NeedVersionConflict:
description: >-
`expected_version` is not the current need version; code
version_conflict. Nothing was changed; read the need again before
retrying.
content:
application/problem+json:
schema:
$ref: ./schemas.yml#/Problem
examples:
version_conflict:
$ref: ./examples.yml#/NeedStaleVersion
+912
View File
@@ -1624,6 +1624,918 @@ Session:
$ref: '#/Account'
csrf_token:
$ref: '#/CsrfToken'
NeedVersion:
type: integer
format: int64
minimum: 1
description: Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.
examples:
- 2
NeedTitle:
type: string
minLength: 1
maxLength: 200
pattern: ^\S(?:.*\S)?$
description: Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.
NeedSourceText:
type: string
minLength: 1
maxLength: 10000
description: 'Free description of the team''s tasks as the employer wrote or pasted it. The server extracts proposed requirements from it; the text itself is never a requirement. It may contain line breaks. Plain text; clients show it as text, never as HTML. It describes the job and must not contain personal data of candidates. The server stores it as written: it may contain requirements that discriminate by a protected characteristic, and the extractor never turns such a requirement into a need field. Exclusions, the requirements that a candidate must not meet, are planned as a separate additive field with the Labor Code article 64 check (TASK-182).'
NeedValueStatus:
type: string
description: 'Confirmation state of one need field.
- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.
- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.
- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'
enum:
- confirmed
- extracted
- unknown
NeedItemStatus:
type: string
description: 'Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'
enum:
- confirmed
- extracted
NeedValueOrigin:
type: string
description: 'Where the value of a field or item came from. The server sets it; a request never sends it.
- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.
- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.
- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.
Confirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'
enum:
- manual
- extracted_from_text
- imported
NeedSourceQuote:
type: string
minLength: 1
maxLength: 300
description: Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.
NeedVersionLabel:
type: string
minLength: 1
maxLength: 64
pattern: ^[A-Za-z0-9._-]+$
description: Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.
NeedValueSource:
type: object
description: 'Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'
additionalProperties: false
required:
- origin
- quote
- extracted_in_version
- extraction_version
properties:
origin:
$ref: '#/NeedValueOrigin'
quote:
description: Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.
oneOf:
- $ref: '#/NeedSourceQuote'
- type: 'null'
extracted_in_version:
description: Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.
oneOf:
- $ref: '#/NeedVersion'
- type: 'null'
extraction_version:
description: Extractor version for an extracted or imported value, or null for a manual value.
oneOf:
- $ref: '#/NeedVersionLabel'
- type: 'null'
SkillName:
type: string
minLength: 1
maxLength: 100
pattern: ^\S(?:.*\S)?$
description: Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.
SkillTaxonomyCode:
type: string
minLength: 1
maxLength: 64
pattern: ^[a-z0-9][a-z0-9_.+#-]*$
description: Code of a skill in the platform skill taxonomy, for example `postgresql`. The server assigns it from the taxonomy; clients never send it and never derive it from the name.
NeedTaskText:
type: string
minLength: 1
maxLength: 300
pattern: ^\S(?:.*\S)?$
description: One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.
NeedDomainName:
type: string
minLength: 1
maxLength: 100
pattern: ^\S(?:.*\S)?$
description: Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.
NeedLocationName:
type: string
minLength: 1
maxLength: 100
pattern: ^\S(?:.*\S)?$
description: Place of work for the office or hybrid format, for example a city, as free text. It describes the employer's office, never a candidate's address. Plain text without line breaks; clients show it as text, never as HTML.
RubAmount:
type: integer
format: int64
minimum: 1000
maximum: 100000000
multipleOf: 1000
description: Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.
examples:
- 120000
CurrencyCode:
type: string
description: ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.
enum:
- RUB
SalaryPeriod:
type: string
description: Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.
enum:
- month
SalaryTaxBasis:
type: string
description: 'Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.'
enum:
- net
- gross
SalaryRange:
type: object
description: 'Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'
additionalProperties: false
required:
- salary_from
- salary_to
- currency
- period
- tax_basis
properties:
salary_from:
$ref: '#/RubAmount'
salary_to:
$ref: '#/RubAmount'
currency:
$ref: '#/CurrencyCode'
period:
$ref: '#/SalaryPeriod'
tax_basis:
$ref: '#/SalaryTaxBasis'
NeedSpecialization:
type: object
description: Target specialization of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.
additionalProperties: false
required:
- status
- value
- source
properties:
status:
$ref: '#/NeedValueStatus'
value:
oneOf:
- $ref: '#/SpecializationCode'
- type: 'null'
source:
oneOf:
- $ref: '#/NeedValueSource'
- type: 'null'
NeedGrade:
type: object
description: Target grade of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a text that names no grade leaves the grade unknown instead of assuming one.
additionalProperties: false
required:
- status
- value
- source
properties:
status:
$ref: '#/NeedValueStatus'
value:
oneOf:
- $ref: '#/GradeCode'
- type: 'null'
source:
oneOf:
- $ref: '#/NeedValueSource'
- type: 'null'
NeedDomain:
type: object
description: Business domain of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.
additionalProperties: false
required:
- status
- value
- source
properties:
status:
$ref: '#/NeedValueStatus'
value:
oneOf:
- $ref: '#/NeedDomainName'
- type: 'null'
source:
oneOf:
- $ref: '#/NeedValueSource'
- type: 'null'
NeedWorkFormats:
type: object
description: Work formats that the employer offers, with their confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a known value lists one to three formats.
additionalProperties: false
required:
- status
- value
- source
properties:
status:
$ref: '#/NeedValueStatus'
value:
type:
- array
- 'null'
minItems: 1
maxItems: 3
uniqueItems: true
items:
$ref: '#/WorkFormat'
source:
oneOf:
- $ref: '#/NeedValueSource'
- type: 'null'
NeedLocation:
type: object
description: Place of work with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. Readiness requires a confirmed place only when the confirmed work formats include `office` or `hybrid`.
additionalProperties: false
required:
- status
- value
- source
properties:
status:
$ref: '#/NeedValueStatus'
value:
oneOf:
- $ref: '#/NeedLocationName'
- type: 'null'
source:
oneOf:
- $ref: '#/NeedValueSource'
- type: 'null'
NeedSalary:
type: object
description: Salary range that the employer offers, with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. A text without a salary leaves it unknown; the server never substitutes zero, a market estimate, or a range from another need.
additionalProperties: false
required:
- status
- value
- source
properties:
status:
$ref: '#/NeedValueStatus'
value:
oneOf:
- $ref: '#/SalaryRange'
- type: 'null'
source:
oneOf:
- $ref: '#/NeedValueSource'
- type: 'null'
NeedSkill:
type: object
description: 'One required or desired skill of the need. `taxonomy_code` is null for a skill that the platform taxonomy does not know: the server keeps the name as given, never maps it to a guessed code, and counts it as not covered in category recommendations.'
additionalProperties: false
required:
- name
- taxonomy_code
- status
- source
properties:
name:
$ref: '#/SkillName'
taxonomy_code:
oneOf:
- $ref: '#/SkillTaxonomyCode'
- type: 'null'
status:
$ref: '#/NeedItemStatus'
source:
$ref: '#/NeedValueSource'
NeedTask:
type: object
description: One work task of the team with its confirmation state and provenance.
additionalProperties: false
required:
- text
- status
- source
properties:
text:
$ref: '#/NeedTaskText'
status:
$ref: '#/NeedItemStatus'
source:
$ref: '#/NeedValueSource'
NeedSpecializationInput:
type: object
description: Decision about the specialization in a request; see NeedUpdate for the rules of `status`.
additionalProperties: false
required:
- value
- status
properties:
value:
$ref: '#/SpecializationCode'
status:
$ref: '#/NeedItemStatus'
NeedGradeInput:
type: object
description: Decision about the grade in a request; see NeedUpdate for the rules of `status`.
additionalProperties: false
required:
- value
- status
properties:
value:
$ref: '#/GradeCode'
status:
$ref: '#/NeedItemStatus'
NeedDomainInput:
type: object
description: Decision about the domain in a request; see NeedUpdate for the rules of `status`.
additionalProperties: false
required:
- value
- status
properties:
value:
$ref: '#/NeedDomainName'
status:
$ref: '#/NeedItemStatus'
NeedWorkFormatsInput:
type: object
description: Decision about the work formats in a request; see NeedUpdate for the rules of `status`. Formats are compared as a set.
additionalProperties: false
required:
- value
- status
properties:
value:
type: array
minItems: 1
maxItems: 3
uniqueItems: true
items:
$ref: '#/WorkFormat'
status:
$ref: '#/NeedItemStatus'
NeedLocationInput:
type: object
description: Decision about the place of work in a request; see NeedUpdate for the rules of `status`.
additionalProperties: false
required:
- value
- status
properties:
value:
$ref: '#/NeedLocationName'
status:
$ref: '#/NeedItemStatus'
NeedSalaryInput:
type: object
description: Decision about the salary range in a request; see NeedUpdate for the rules of `status` and SalaryRange for the rules of the range, whose pointers are under `/salary/value`.
additionalProperties: false
required:
- value
- status
properties:
value:
$ref: '#/SalaryRange'
status:
$ref: '#/NeedItemStatus'
NeedSkillInput:
type: object
description: 'One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.'
additionalProperties: false
required:
- name
- status
properties:
name:
$ref: '#/SkillName'
status:
$ref: '#/NeedItemStatus'
NeedTaskInput:
type: object
description: One task of the list in a request. A text equal to a task of the current version refers to that task and keeps its origin and quote; any other text is a new manual task. `status` and repeated texts follow the rules of NeedSkillInput.
additionalProperties: false
required:
- text
- status
properties:
text:
$ref: '#/NeedTaskText'
status:
$ref: '#/NeedItemStatus'
NeedRequirementSet:
type: object
description: Requirements of one need version, each with its confirmation state and provenance. Read-only; requests change them through the fields of NeedCreate and NeedUpdate.
additionalProperties: false
required:
- specialization
- grade
- required_skills
- desired_skills
- tasks
- domain
- work_formats
- location
- salary
properties:
specialization:
$ref: '#/NeedSpecialization'
grade:
$ref: '#/NeedGrade'
required_skills:
type: array
maxItems: 30
description: Required skills; each has weight 2 in skill coverage. Only confirmed skills count.
items:
$ref: '#/NeedSkill'
desired_skills:
type: array
maxItems: 30
description: Desired skills; each has weight 1 in skill coverage. Only confirmed skills count.
items:
$ref: '#/NeedSkill'
tasks:
type: array
maxItems: 20
description: Work tasks of the team in the order given.
items:
$ref: '#/NeedTask'
domain:
$ref: '#/NeedDomain'
work_formats:
$ref: '#/NeedWorkFormats'
location:
$ref: '#/NeedLocation'
salary:
$ref: '#/NeedSalary'
NeedFieldName:
type: string
description: Name of a need field, equal to its property name in NeedRequirementSet and in the request bodies. Adding a value is a contract change.
enum:
- specialization
- grade
- required_skills
- desired_skills
- tasks
- domain
- work_formats
- location
- salary
NeedMissingReason:
type: string
description: 'Why a critical field is missing: `unknown`, the field has no value, or `unconfirmed`, it has only an extracted value or, for required skills, only extracted items that wait for confirmation.'
enum:
- unknown
- unconfirmed
NeedMissingField:
type: object
description: One critical field that has no confirmed value, with a specific question that the client shows next to the field.
additionalProperties: false
required:
- field
- reason
- question
properties:
field:
$ref: '#/NeedFieldName'
reason:
$ref: '#/NeedMissingReason'
question:
type: string
minLength: 1
maxLength: 300
description: Specific Russian question about the missing value, for example which grade is needed. Plain text; the client shows it as text, never as HTML.
NeedReadinessStatus:
type: string
description: '`complete` when every critical field has a confirmed value, otherwise `incomplete`.'
enum:
- complete
- incomplete
NeedReadinessReport:
type: object
description: Completeness of the critical fields, computed by the server for the current version. The critical fields are `specialization`, `grade`, `required_skills` (at least one confirmed skill), `work_formats`, `salary`, and `location` when the confirmed work formats include `office` or `hybrid`. An incomplete need is still a valid saved need; each later operation, such as search or an invitation, states which readiness it requires.
additionalProperties: false
required:
- status
- missing_fields
properties:
status:
$ref: '#/NeedReadinessStatus'
missing_fields:
type: array
maxItems: 9
description: Critical fields without a confirmed value, each at most once, in the order of NeedFieldName. Empty exactly when `status` is `complete`.
items:
$ref: '#/NeedMissingField'
NeedRecommendationStatus:
type: string
description: 'State of the category recommendations of the current requirements version.
- computed: `categories` holds the recommendations computed from the confirmed requirements of `requirements_version`.
- pending: the computation for the current requirements version has not finished yet; `categories` is empty. Read the need again later.
- not_available: the current requirements have no confirmed required or desired skill to compute from; `categories` is empty.'
enum:
- computed
- pending
- not_available
NeedSkillOverlap:
type: object
description: 'Skill coverage of a category: the weighted share of the confirmed skills of the need that the category taxonomy covers, with weight 2 for a required and 1 for a desired skill.'
additionalProperties: false
required:
- share
- covered_skills
- uncovered_skills
properties:
share:
type: number
format: double
minimum: 0
maximum: 1
description: Weighted share from 0 to 1, rounded to two decimals.
covered_skills:
type: array
maxItems: 60
description: Confirmed skills of the need that the category covers.
items:
$ref: '#/SkillName'
uncovered_skills:
type: array
maxItems: 60
description: Confirmed skills of the need that the category does not cover, including skills without a taxonomy code.
items:
$ref: '#/SkillName'
NeedMoneyStatus:
type: string
description: 'How the salary component of a recommendation was obtained.
- computed: at least five available candidates of the category have a known minimum comparable with the confirmed range; `share` is given.
- insufficient_data: fewer than five such candidates; the policy uses the neutral value 0.5 and `share` is null.
- no_salary: the need has no confirmed salary range; the policy uses the neutral value 0.5 and `share` is null.
- withheld: the organization changed salary ranges five times within seven days, so salary aggregates are withheld for seven days (PRD FR13, planned in TASK-211); the policy uses the neutral value 0.5 and `share` is null.
An unknown candidate minimum never counts as zero.'
enum:
- computed
- insufficient_data
- no_salary
- withheld
NeedMoneyFit:
type: object
description: Salary component of a recommendation. It is an aggregate over at least five candidates and never reveals a minimum of any candidate.
additionalProperties: false
required:
- status
- share
properties:
status:
$ref: '#/NeedMoneyStatus'
share:
type:
- number
- 'null'
format: double
minimum: 0
maximum: 1
description: 'Share of those candidates whose minimum is not above the upper bound of the range, rounded down to a multiple of 0.25 (one of 0, 0.25, 0.5, 0.75, 1), or null unless `status` is `computed`. The score and the ranking use this rounded value, never the exact share. A quarter step gives five levels: each probe of a new upper bound tells at most which quarter of the group accepts it, and in the smallest allowed group of five candidates a single minimum often does not move the value, while the share still separates a range that most candidates accept from one that few accept.'
NeedSupplyBand:
type: string
description: 'Number of available candidates of the category in the allowed detail: `fewer_than_5`, `from_5_to_29`, or `30_or_more`. Smaller groups are never counted exactly.'
enum:
- fewer_than_5
- from_5_to_29
- 30_or_more
NeedCategoryRecommendation:
type: object
description: 'One recommended category, a specialization with a grade, with its score and the reasons for it. The score is `0.5 * Overlap + 0.3 * Money + 0.2 * Supply` (PRD FR08) computed from the published components: the exact skill overlap, the money share rounded down to a quarter or the neutral 0.5, and `Supply = min(1, active / 30)` when at least five candidates are available. For a group of fewer than five, Supply enters the ranking as 0, the same for every such group, so neither the score nor the order reveals the exact size of a group below five.'
additionalProperties: false
required:
- specialization
- grade
- score
- skill_overlap
- money
- supply
properties:
specialization:
$ref: '#/SpecializationCode'
grade:
$ref: '#/GradeCode'
score:
type:
- number
- 'null'
format: double
minimum: 0
maximum: 1
description: Recommendation score from 0 to 1, rounded half up to two decimals, or null when `supply` is `fewer_than_5`. Read-only; no request can set it.
skill_overlap:
$ref: '#/NeedSkillOverlap'
money:
$ref: '#/NeedMoneyFit'
supply:
$ref: '#/NeedSupplyBand'
NeedCategoryRecommendations:
type: object
description: 'Category recommendations computed by the server from the confirmed requirements of `requirements_version` with a versioned policy (PRD FR08). Read-only: no request can set a recommendation, a score, or one of its components. The server may recompute them for the same requirements version, for example for a new policy or a changed pool of available candidates, without a new need version; `computed_at` and `policy_version` then change. The policy version and the candidate group used are stored with each computation, so a later policy never rewrites it.'
additionalProperties: false
required:
- status
- requirements_version
- policy_version
- algorithm_version
- computed_at
- categories
properties:
status:
$ref: '#/NeedRecommendationStatus'
requirements_version:
$ref: '#/NeedVersion'
policy_version:
type:
- integer
- 'null'
format: int32
minimum: 1
description: Number of the policy version whose weights were applied, or null unless `status` is `computed`.
algorithm_version:
description: Version of the recommendation algorithm, or null unless `status` is `computed`.
oneOf:
- $ref: '#/NeedVersionLabel'
- type: 'null'
computed_at:
description: Time of the computation, or null unless `status` is `computed`.
oneOf:
- $ref: '#/Timestamp'
- type: 'null'
categories:
type: array
maxItems: 10
description: Recommended categories, best first by the score described in NeedCategoryRecommendation. Empty unless `status` is `computed`.
items:
$ref: '#/NeedCategoryRecommendation'
Need:
type: object
description: 'Hiring need of an organization: what the team needs, independent of any published vacancy. It holds the current version of the requirements with their provenance, the readiness of the critical fields, and the category recommendations. It never contains membership data, a candidate''s personal data, or a candidate''s salary minimum.'
additionalProperties: false
required:
- id
- organization_id
- vacancy_id
- title
- source_text
- version
- requirements_version
- requirements
- readiness
- recommendations
- created_at
- updated_at
properties:
id:
type: string
format: uuid
description: Identifier of the need.
organization_id:
type: string
format: uuid
description: Organization that owns the need, equal to `org_id` of the path. It never changes.
vacancy_id:
type:
- string
- 'null'
format: uuid
description: Linked vacancy of the same organization, or null. A need never requires a vacancy.
title:
$ref: '#/NeedTitle'
source_text:
description: Text the requirements were extracted from, or null.
oneOf:
- $ref: '#/NeedSourceText'
- type: 'null'
version:
$ref: '#/NeedVersion'
requirements_version:
description: Need version in which the current confirmed requirements were last changed, at most `version`. A change that confirms, changes, or removes a requirement makes it equal to the new `version`. A change of the title, the vacancy link, or the text, or of suggestions only, creates a new `version` but keeps `requirements_version`, so it invalidates neither the recommendations nor search results and selection snapshots. Search runs and selection snapshots (PRD FR10) refer to `(need id, requirements_version)`, and a new selection snapshot is due only when it changes.
allOf:
- $ref: '#/NeedVersion'
requirements:
$ref: '#/NeedRequirementSet'
readiness:
$ref: '#/NeedReadinessReport'
recommendations:
$ref: '#/NeedCategoryRecommendations'
created_at:
$ref: '#/Timestamp'
updated_at:
$ref: '#/Timestamp'
NeedSummary:
type: object
description: 'Need in a list: its identity, current version, target category fields, and readiness. Read the need for the requirements and the recommendations.'
additionalProperties: false
required:
- id
- vacancy_id
- title
- version
- specialization
- grade
- readiness
- created_at
- updated_at
properties:
id:
type: string
format: uuid
description: Identifier of the need.
vacancy_id:
type:
- string
- 'null'
format: uuid
description: Linked vacancy, or null.
title:
$ref: '#/NeedTitle'
version:
$ref: '#/NeedVersion'
specialization:
$ref: '#/NeedSpecialization'
grade:
$ref: '#/NeedGrade'
readiness:
$ref: '#/NeedReadinessReport'
created_at:
$ref: '#/Timestamp'
updated_at:
$ref: '#/Timestamp'
NeedList:
type: object
description: One page of the needs of an organization, newest first by creation time.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Needs of the page.
items:
$ref: '#/NeedSummary'
page:
$ref: '#/PageInfo'
NeedCreate:
type: object
description: New need. Only `title` is required, so a need can start from a title, from a text, or from form fields, and with or without a vacancy. A field or list item given here must have `status` `confirmed` and becomes a confirmed manual value; `extracted` answers 400 with the pointer of that `status`, such as `/grade/status`, because a new need has no stored suggestion. A field that is absent is extracted from `source_text` when the text is given and is left unknown or empty otherwise. A nullable field sent as null, and a skill or task list sent as an empty list, stays unknown or empty and is not extracted; an empty `work_formats` value fails `minItems`. Unknown fields are rejected, so a request cannot set membership, a role, a status of the need, a provenance, readiness, a recommendation or its score, or a candidate's salary minimum.
additionalProperties: false
required:
- title
properties:
title:
$ref: '#/NeedTitle'
vacancy_id:
type:
- string
- 'null'
format: uuid
description: Vacancy of the same organization to link, or null or absent for a need without a vacancy.
source_text:
oneOf:
- $ref: '#/NeedSourceText'
- type: 'null'
specialization:
oneOf:
- $ref: '#/NeedSpecializationInput'
- type: 'null'
grade:
oneOf:
- $ref: '#/NeedGradeInput'
- type: 'null'
required_skills:
type: array
maxItems: 30
items:
$ref: '#/NeedSkillInput'
desired_skills:
type: array
maxItems: 30
items:
$ref: '#/NeedSkillInput'
tasks:
type: array
maxItems: 20
items:
$ref: '#/NeedTaskInput'
domain:
oneOf:
- $ref: '#/NeedDomainInput'
- type: 'null'
work_formats:
oneOf:
- $ref: '#/NeedWorkFormatsInput'
- type: 'null'
location:
oneOf:
- $ref: '#/NeedLocationInput'
- type: 'null'
salary:
oneOf:
- $ref: '#/NeedSalaryInput'
- type: 'null'
NeedUpdate:
type: object
description: 'Change of a need over the version the client read. Each field present in the body replaces that field as a whole; an absent field stays unchanged. Nested objects and lists are not merged: a field decision and each list are replaced entirely, and a stored item missing from a sent list is deleted. A nullable field sent as null becomes unknown, or unlinked for `vacancy_id`; a skill or task list sent empty deletes every item; a list sent as null fails validation. A field decision `{value, status}` and a list item follow the same rules: `confirmed` with the stored value confirms it and keeps its origin and quote, and `confirmed` with another value sets a confirmed manual value; `extracted` keeps a stored suggestion unconfirmed and is allowed only with exactly the stored suggested value, otherwise it answers 400 with the pointer of that `status`, such as `/grade/status` or `/required_skills/0/status`. A client that sends back an unchanged form therefore confirms nothing by accident:
it sends each suggestion with `extracted`, or leaves the field out. Sending a different `source_text` extracts again: new suggestions replace only the `extracted` values and items of fields not named in this body; confirmed values are never overwritten, a suggested skill whose name is already in either skill list is skipped, and a suggestion that a member deleted is not proposed again for this need. Unknown fields are rejected, so a request cannot set membership, a role, a provenance, readiness, a recommendation or its score, or a candidate''s salary minimum.'
additionalProperties: false
required:
- expected_version
properties:
expected_version:
$ref: '#/NeedVersion'
title:
$ref: '#/NeedTitle'
vacancy_id:
type:
- string
- 'null'
format: uuid
description: Vacancy of the same organization to link, or null to unlink.
source_text:
oneOf:
- $ref: '#/NeedSourceText'
- type: 'null'
specialization:
oneOf:
- $ref: '#/NeedSpecializationInput'
- type: 'null'
grade:
oneOf:
- $ref: '#/NeedGradeInput'
- type: 'null'
required_skills:
type: array
maxItems: 30
items:
$ref: '#/NeedSkillInput'
desired_skills:
type: array
maxItems: 30
items:
$ref: '#/NeedSkillInput'
tasks:
type: array
maxItems: 20
items:
$ref: '#/NeedTaskInput'
domain:
oneOf:
- $ref: '#/NeedDomainInput'
- type: 'null'
work_formats:
oneOf:
- $ref: '#/NeedWorkFormatsInput'
- type: 'null'
location:
oneOf:
- $ref: '#/NeedLocationInput'
- type: 'null'
salary:
oneOf:
- $ref: '#/NeedSalaryInput'
- type: 'null'
Problem:
type: object
description: Problem details (RFC 9457) returned with the application/problem+json media type for every error response. `code` is the stable, machine-readable reason; clients branch on it rather than on `title`, `detail`, or the HTTP status alone. The body never contains internal error text, stack traces, SQL, file paths, credentials, contact data, or echoed request values.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+124
View File
@@ -26,6 +26,12 @@ tags:
Assessment attempts of the current candidate: availability, start and
resume, answers and the code practice, finalization, and the result.
Answers, keys, and attempt history are visible only to the candidate.
- name: need
description: >-
Hiring needs of an organization: requirements with their confirmation
state and provenance, immutable versions, readiness, and category
recommendations. Access comes only from an active membership in the
organization; a need never requires a vacancy.
# Operations require a session unless they declare `security: []`, so a new
# operation that omits security is protected by default.
security:
@@ -63,6 +69,10 @@ paths:
$ref: ./routes/candidate_assessment_attempt_finalize.yml
/api/v1/me/assessment-attempts/{attempt_id}/result:
$ref: ./routes/candidate_assessment_attempt_result.yml
/api/v1/organizations/{org_id}/needs:
$ref: ./routes/organization_needs.yml
/api/v1/organizations/{org_id}/needs/{need_id}:
$ref: ./routes/organization_need.yml
components:
schemas:
Problem:
@@ -265,6 +275,112 @@ components:
$ref: ./components/schemas.yml#/AssessmentSpecializationAvailability
AssessmentAvailability:
$ref: ./components/schemas.yml#/AssessmentAvailability
NeedVersion:
$ref: ./components/schemas.yml#/NeedVersion
NeedTitle:
$ref: ./components/schemas.yml#/NeedTitle
NeedSourceText:
$ref: ./components/schemas.yml#/NeedSourceText
NeedValueStatus:
$ref: ./components/schemas.yml#/NeedValueStatus
NeedItemStatus:
$ref: ./components/schemas.yml#/NeedItemStatus
NeedValueOrigin:
$ref: ./components/schemas.yml#/NeedValueOrigin
NeedSourceQuote:
$ref: ./components/schemas.yml#/NeedSourceQuote
NeedVersionLabel:
$ref: ./components/schemas.yml#/NeedVersionLabel
NeedValueSource:
$ref: ./components/schemas.yml#/NeedValueSource
SkillName:
$ref: ./components/schemas.yml#/SkillName
SkillTaxonomyCode:
$ref: ./components/schemas.yml#/SkillTaxonomyCode
NeedTaskText:
$ref: ./components/schemas.yml#/NeedTaskText
NeedDomainName:
$ref: ./components/schemas.yml#/NeedDomainName
NeedLocationName:
$ref: ./components/schemas.yml#/NeedLocationName
RubAmount:
$ref: ./components/schemas.yml#/RubAmount
CurrencyCode:
$ref: ./components/schemas.yml#/CurrencyCode
SalaryPeriod:
$ref: ./components/schemas.yml#/SalaryPeriod
SalaryTaxBasis:
$ref: ./components/schemas.yml#/SalaryTaxBasis
SalaryRange:
$ref: ./components/schemas.yml#/SalaryRange
NeedSpecialization:
$ref: ./components/schemas.yml#/NeedSpecialization
NeedGrade:
$ref: ./components/schemas.yml#/NeedGrade
NeedDomain:
$ref: ./components/schemas.yml#/NeedDomain
NeedWorkFormats:
$ref: ./components/schemas.yml#/NeedWorkFormats
NeedLocation:
$ref: ./components/schemas.yml#/NeedLocation
NeedSalary:
$ref: ./components/schemas.yml#/NeedSalary
NeedSkill:
$ref: ./components/schemas.yml#/NeedSkill
NeedTask:
$ref: ./components/schemas.yml#/NeedTask
NeedSpecializationInput:
$ref: ./components/schemas.yml#/NeedSpecializationInput
NeedGradeInput:
$ref: ./components/schemas.yml#/NeedGradeInput
NeedDomainInput:
$ref: ./components/schemas.yml#/NeedDomainInput
NeedWorkFormatsInput:
$ref: ./components/schemas.yml#/NeedWorkFormatsInput
NeedLocationInput:
$ref: ./components/schemas.yml#/NeedLocationInput
NeedSalaryInput:
$ref: ./components/schemas.yml#/NeedSalaryInput
NeedSkillInput:
$ref: ./components/schemas.yml#/NeedSkillInput
NeedTaskInput:
$ref: ./components/schemas.yml#/NeedTaskInput
NeedRequirementSet:
$ref: ./components/schemas.yml#/NeedRequirementSet
NeedFieldName:
$ref: ./components/schemas.yml#/NeedFieldName
NeedMissingReason:
$ref: ./components/schemas.yml#/NeedMissingReason
NeedMissingField:
$ref: ./components/schemas.yml#/NeedMissingField
NeedReadinessStatus:
$ref: ./components/schemas.yml#/NeedReadinessStatus
NeedReadinessReport:
$ref: ./components/schemas.yml#/NeedReadinessReport
NeedRecommendationStatus:
$ref: ./components/schemas.yml#/NeedRecommendationStatus
NeedSkillOverlap:
$ref: ./components/schemas.yml#/NeedSkillOverlap
NeedMoneyStatus:
$ref: ./components/schemas.yml#/NeedMoneyStatus
NeedMoneyFit:
$ref: ./components/schemas.yml#/NeedMoneyFit
NeedSupplyBand:
$ref: ./components/schemas.yml#/NeedSupplyBand
NeedCategoryRecommendation:
$ref: ./components/schemas.yml#/NeedCategoryRecommendation
NeedCategoryRecommendations:
$ref: ./components/schemas.yml#/NeedCategoryRecommendations
Need:
$ref: ./components/schemas.yml#/Need
NeedSummary:
$ref: ./components/schemas.yml#/NeedSummary
NeedList:
$ref: ./components/schemas.yml#/NeedList
NeedCreate:
$ref: ./components/schemas.yml#/NeedCreate
NeedUpdate:
$ref: ./components/schemas.yml#/NeedUpdate
parameters:
IdempotencyKey:
$ref: ./components/parameters.yml#/IdempotencyKey
@@ -276,6 +392,10 @@ components:
$ref: ./components/parameters.yml#/PageCursor
AssessmentAttemptId:
$ref: ./components/parameters.yml#/AssessmentAttemptId
OrganizationId:
$ref: ./components/parameters.yml#/OrganizationId
NeedId:
$ref: ./components/parameters.yml#/NeedId
headers:
ETag:
$ref: ./components/headers.yml#/ETag
@@ -344,6 +464,10 @@ components:
$ref: ./components/responses.yml#/AssessmentResultNotReady
AssessmentVersionConflict:
$ref: ./components/responses.yml#/AssessmentVersionConflict
NeedValidationFailed:
$ref: ./components/responses.yml#/NeedValidationFailed
NeedVersionConflict:
$ref: ./components/responses.yml#/NeedVersionConflict
securitySchemes:
sessionCookie:
type: apiKey
+113
View File
@@ -0,0 +1,113 @@
get:
operationId: GetOrganizationNeed
summary: Read the current version of a need of an organization.
description: |-
Requires the session cookie of an employer account with an active membership in `org_id`. The organization and the role come from the server-side membership, never from the request. In the MVP only the owner of the organization reads needs; the other roles of PRD FR07 are planned.
Returns the current version of the need: `version`, the requirements with the confirmation state and provenance of each field (`status`, and `source` with the origin, the quote, the version whose text the quote belongs to, and the extractor version), the readiness with `missing_fields`, and the category recommendations of the server. A field with status `unknown` has null value and source; an `extracted` value is a suggestion that waits for confirmation and never feeds search or recommendations.
Versions: every committed change creates a new immutable `version`, and this operation always returns the latest one. `requirements_version` is the version in which the confirmed requirements were last changed; a change of the title, the vacancy link, the text, or suggestions only keeps it. Search runs, selection snapshots, and invitations refer to a need by its identifier and `requirements_version`, so they keep the requirements they used, and only a new `requirements_version` calls for a new selection snapshot. Reading and comparing earlier versions (PRD FR10) are planned as separate operations that return the same NeedRequirementSet for a given version; they add no field here.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an account without an active membership in the organization, an unknown organization, an unknown need, and a need of another organization all answer 404 not_found, so identifiers cannot be probed; a member whose role does not allow reading the need answers 403 forbidden. An `org_id` or `need_id` that is not a UUID answers 400 validation_failed with the path pointer.
security:
- sessionCookie: []
tags:
- need
parameters:
- $ref: ../components/parameters.yml#/OrganizationId
- $ref: ../components/parameters.yml#/NeedId
responses:
"200":
description: The current version of the need.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/Need
examples:
manual_without_vacancy:
$ref: ../components/examples.yml#/NeedManualWithoutVacancy
from_text_with_unknown_skill:
$ref: ../components/examples.yml#/NeedExtractedWithUnknownSkill
confirmed:
$ref: ../components/examples.yml#/NeedConfirmedAfterUpdate
"400":
$ref: ../components/responses.yml#/ValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
$ref: ../components/responses.yml#/Forbidden
"404":
$ref: ../components/responses.yml#/NotFound
default:
$ref: ../components/responses.yml#/Problem
patch:
operationId: UpdateOrganizationNeed
summary: Confirm, change, or delete requirements of a need.
description: |-
Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization and the role come from the server-side membership; the body has no organization, membership, or role field. In the MVP only the owner of the organization changes needs; the technical expert, who may refine the requirements of assigned needs under PRD FR07, is planned.
Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch. Each field present replaces that field as a whole and an absent field stays unchanged; a field decision and each list are replaced entirely and never merged. This keeps every field one optional value in the generated server and client, without nested partial updates.
Each requirement field is sent as a decision `{value, status}` and each list item as `{name or text, status}`, so confirmation is always explicit:
- Confirm a suggestion: send its stored value with `confirmed`. It keeps its origin and quote.
- Keep a suggestion open: send its stored value with `extracted`, or leave the field out. `extracted` with any other value, or for a field or item without a stored suggestion, answers 400 with the pointer of that `status`, for example `/grade/status` or `/required_skills/2/status`. A client that sends back an unchanged form therefore never confirms a suggestion by accident.
- Change: send another value with `confirmed`. It becomes a confirmed manual value, and its quote is dropped.
- Delete: send null for a nullable field, which makes it `unknown` (or unlinks `vacancy_id`), or leave the item out of a skill or task list, which deletes it. An empty skill or task list deletes every item; a list sent as null answers 400. A deleted requirement really changes the requirements that search uses, not only an explanation, and a deleted suggestion is not proposed again by a later extraction.
- Text: a different `source_text` extracts again. New suggestions replace only the `extracted` values and items of the fields not named in the body; confirmed values are never overwritten, and a suggested skill whose name is already in either skill list is skipped. Null removes the text and keeps every value.
Versions: every committed change creates version `expected_version + 1` as an immutable snapshot and answers 200 with it. `requirements_version` becomes the new version only when a confirmed requirement was confirmed, changed, or removed. `expected_version` is the `version` the client read; when it is not current, the server answers 412 version_conflict and changes nothing, and the client reads the need again and reapplies its unsaved edits. The version travels in the body rather than in If-Match because the generated client cannot read the ETag response header yet, as for the questionnaire. Concurrent changes therefore never overwrite each other silently.
The operation needs no Idempotency-Key: a body that changes nothing when applied to the current version, such as a retry of a change that already succeeded, keeps the version and answers 200 with the current need even when `expected_version` is older. An incomplete need is a valid result; `readiness.missing_fields` tells what remains.
Salary limit: the recommendations aggregate candidates' minimums against the upper bound, so setting or changing a confirmed salary range counts against a limit shared by the whole organization, every member and every need, together with ranges set on creation: at most three a day (PRD FR13, planned in TASK-211). Over the limit the server answers 429 with Retry-After and changes nothing. After five settings within seven days the money component is `withheld` for seven days. Repeated range changes also feed the private risk signals of TASK-319.
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403 forbidden), the need (404 not_found), a body that changes nothing (200), the version (412), domain rules (400 with a pointer such as `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose width is outside 10-40%, `/desired_skills/0/name` for a skill that is also in the required list, `/grade/status` or `/required_skills/2/status` for `extracted` with a value that is not the stored suggestion, or `/vacancy_id`), then the salary change limit (429). The schema rejects a missing or non-positive `expected_version`, unknown fields such as `rec_score`, `members`, `candidate_minimum`, or `version`, a field sent as a bare value instead of `{value, status}`, a list sent as null, a salary bound that is not a positive multiple of 1000, and an unknown currency, period, or tax basis.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- need
parameters:
- $ref: ../components/parameters.yml#/OrganizationId
- $ref: ../components/parameters.yml#/NeedId
requestBody:
required: true
content:
application/json:
schema:
$ref: ../components/schemas.yml#/NeedUpdate
examples:
confirm_suggestions:
$ref: ../components/examples.yml#/NeedUpdateConfirmSuggestions
responses:
"200":
description: >-
The need after the change, or the current need when the body changes
nothing.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/Need
examples:
confirmed:
$ref: ../components/examples.yml#/NeedConfirmedAfterUpdate
"400":
$ref: ../components/responses.yml#/NeedValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
"404":
$ref: ../components/responses.yml#/NotFound
"412":
$ref: ../components/responses.yml#/NeedVersionConflict
"429":
$ref: ../components/responses.yml#/TooManyRequests
default:
$ref: ../components/responses.yml#/Problem
+109
View File
@@ -0,0 +1,109 @@
get:
operationId: ListOrganizationNeeds
summary: List the needs of an organization.
description: |-
Requires the session cookie of an employer account with an active membership in `org_id`. The organization and the role come from the membership that the server holds for the session account, never from the request. In the MVP only the owner of the organization works with needs; the other roles of the PRD FR07 matrix (recruiter, hiring manager and technical expert for assigned needs) are planned and change no field of this contract. The list holds only the needs that the role may read.
Returns a page of need summaries, newest first by creation time with the identifier as the tie-breaker, with cursor pagination. A summary has the current version, the target specialization and grade with their confirmation state, and the readiness; GetOrganizationNeed returns the requirements and the recommendations.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an account without an active membership in the organization and an unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member whose role does not allow reading needs answers 403 forbidden. A malformed `org_id`, `limit`, or `cursor` answers 400 validation_failed.
security:
- sessionCookie: []
tags:
- need
parameters:
- $ref: ../components/parameters.yml#/OrganizationId
- $ref: ../components/parameters.yml#/PageLimit
- $ref: ../components/parameters.yml#/PageCursor
responses:
"200":
description: A page of the needs of the organization.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/NeedList
examples:
last_page:
$ref: ../components/examples.yml#/NeedListPage
"400":
$ref: ../components/responses.yml#/ValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
$ref: ../components/responses.yml#/Forbidden
"404":
$ref: ../components/responses.yml#/NotFound
default:
$ref: ../components/responses.yml#/Problem
post:
operationId: CreateOrganizationNeed
summary: Create a need of an organization from a form, a text, or both.
description: |-
Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The organization comes from the path and the server-side membership; the body has no organization, membership, or role field. In the MVP only the owner of the organization may create a need; the other roles of PRD FR07 are planned.
A need does not require a vacancy: `vacancy_id` is optional and nullable. When it is given, it must name a vacancy of the same organization; until vacancies exist in the contract, any vacancy identifier answers 400 with the pointer `/vacancy_id`, the same for an unknown vacancy and one of another organization.
Only `title` is required. A field is sent as a decision `{value, status}` and a list item as `{name or text, status}`; on creation the status must be `confirmed`, and the value becomes a confirmed manual value. When `source_text` is given, the server extracts suggestions for the absent fields with deterministic rules and a dictionary before it answers, so creation works while the ML service is disabled; every suggestion has the status `extracted`, the origin extracted_from_text, a quote where the extractor found one, and the extractor version, and it waits for a member to confirm it. A field that the text does not state stays `unknown` with null value and source; the server never guesses a grade, a format, or a salary. ML suggestions with quotes are planned as an asynchronous addition that creates a new version and never overwrites a confirmed value.
The need is saved even when critical fields are missing: the response is 201 with version 1, and `readiness.missing_fields` names each critical field without a confirmed value with a specific question. `recommendations` is computed by the server from the confirmed requirements only; the request cannot set a recommendation, its score, or its components. Creating a need never contacts a candidate or sends an invitation.
Salary limit: setting a salary range counts against a limit shared by the whole organization, every member and every need, on creation as on a change: at most three range settings a day (PRD FR13, planned in TASK-211). Over the limit the server answers 429 with Retry-After and creates nothing. After five settings within seven days the money component of the recommendations is `withheld` for seven days. The limit keeps an organization from probing hidden candidate minimums with new needs instead of edits; repeated range changes also feed the private risk signals of TASK-319.
Idempotency: a retry with the same key and body within 24 hours replays the stored 201 and creates nothing, so a lost response never creates a second need. A different body with the same key answers 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again.
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a pointer: `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose width is outside 10-40%, `/required_skills/1/name` for a repeated skill, `/grade/status` or `/required_skills/0/status` for `extracted`, which a new need cannot have, or `/vacancy_id`), then the salary limit (429). The schema already rejects unknown fields such as `rec_score`, `members`, or `candidate_minimum`, a field sent as a bare value instead of `{value, status}`, a salary bound that is not a positive multiple of 1000, and an unknown currency, period, or tax basis. The general rate limit can answer 429 with Retry-After before any check. 429 is never stored.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- need
parameters:
- $ref: ../components/parameters.yml#/OrganizationId
- $ref: ../components/parameters.yml#/IdempotencyKey
requestBody:
required: true
content:
application/json:
schema:
$ref: ../components/schemas.yml#/NeedCreate
examples:
manual_without_vacancy:
$ref: ../components/examples.yml#/NeedCreateManual
from_text:
$ref: ../components/examples.yml#/NeedCreateFromText
responses:
"201":
description: >-
The need was created as version 1, or a retry with the same
Idempotency-Key replayed its creation.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/Need
examples:
manual_without_vacancy:
$ref: ../components/examples.yml#/NeedManualWithoutVacancy
from_text_with_unknown_skill:
$ref: ../components/examples.yml#/NeedExtractedWithUnknownSkill
"400":
$ref: ../components/responses.yml#/NeedValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
"404":
$ref: ../components/responses.yml#/NotFound
"409":
$ref: ../components/responses.yml#/IdempotencyInProgress
"422":
$ref: ../components/responses.yml#/UnprocessableContent
"429":
$ref: ../components/responses.yml#/TooManyRequests
default:
$ref: ../components/responses.yml#/Problem
@@ -21,6 +21,7 @@ var regexMap = map[string]ogenregex.Regexp{
"^[A-Za-z0-9._-]+$": ogenregex.MustCompile("^[A-Za-z0-9._-]+$"),
"^[A-Za-z0-9._:-]+$": ogenregex.MustCompile("^[A-Za-z0-9._:-]+$"),
"^[A-Za-z0-9_-]+$": ogenregex.MustCompile("^[A-Za-z0-9_-]+$"),
"^[a-z0-9][a-z0-9_.+#-]*$": ogenregex.MustCompile("^[a-z0-9][a-z0-9_.+#-]*$"),
"^[a-z0-9_+-]+$": ogenregex.MustCompile("^[a-z0-9_+-]+$"),
"^[a-z0-9_]+$": ogenregex.MustCompile("^[a-z0-9_]+$"),
"^[a-z][a-z0-9_]*$": ogenregex.MustCompile("^[a-z][a-z0-9_]*$"),
File diff suppressed because it is too large. Load diff
@@ -9,6 +9,10 @@ type CreateMyAssessmentAttemptRes interface {
createMyAssessmentAttemptRes()
}
type CreateOrganizationNeedRes interface {
createOrganizationNeedRes()
}
type FinalizeMyAssessmentAttemptRes interface {
finalizeMyAssessmentAttemptRes()
}
@@ -41,6 +45,14 @@ type GetMyQuestionnaireRes interface {
getMyQuestionnaireRes()
}
type GetOrganizationNeedRes interface {
getOrganizationNeedRes()
}
type ListOrganizationNeedsRes interface {
listOrganizationNeedsRes()
}
type LoginRes interface {
loginRes()
}
@@ -64,3 +76,7 @@ type SaveMyQuestionnaireRes interface {
type SubmitMyAssessmentAnswerRes interface {
submitMyAssessmentAnswerRes()
}
type UpdateOrganizationNeedRes interface {
updateOrganizationNeedRes()
}
File diff suppressed because it is too large. Load diff
@@ -8,6 +8,7 @@ type OperationName = string
const (
ConfirmEmailOperation OperationName = "ConfirmEmail"
CreateMyAssessmentAttemptOperation OperationName = "CreateMyAssessmentAttempt"
CreateOrganizationNeedOperation OperationName = "CreateOrganizationNeed"
FinalizeMyAssessmentAttemptOperation OperationName = "FinalizeMyAssessmentAttempt"
GetConsentTextOperation OperationName = "GetConsentText"
GetCurrentAccountOperation OperationName = "GetCurrentAccount"
@@ -17,11 +18,14 @@ const (
GetMyAssessmentAvailabilityOperation OperationName = "GetMyAssessmentAvailability"
GetMyAssessmentResultOperation OperationName = "GetMyAssessmentResult"
GetMyQuestionnaireOperation OperationName = "GetMyQuestionnaire"
GetOrganizationNeedOperation OperationName = "GetOrganizationNeed"
GetSpecializationCatalogOperation OperationName = "GetSpecializationCatalog"
ListOrganizationNeedsOperation OperationName = "ListOrganizationNeeds"
LoginOperation OperationName = "Login"
LogoutOperation OperationName = "Logout"
RegisterAccountOperation OperationName = "RegisterAccount"
ResendEmailVerificationOperation OperationName = "ResendEmailVerification"
SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire"
SubmitMyAssessmentAnswerOperation OperationName = "SubmitMyAssessmentAnswer"
UpdateOrganizationNeedOperation OperationName = "UpdateOrganizationNeed"
)
@@ -109,6 +109,157 @@ func decodeCreateMyAssessmentAttemptParams(args [0]string, argsEscaped bool, r *
return params, nil
}
// CreateOrganizationNeedParams is parameters of CreateOrganizationNeed operation.
type CreateOrganizationNeedParams struct {
// Identifier of an organization. Access comes only from an active membership of the session account in
// this organization, checked by the server on every request; the identifier itself grants nothing. An
// organization without such a membership and an unknown identifier both answer 404 not_found, so
// organizations cannot be enumerated.
OrgID uuid.UUID
// Client-generated key that makes a retried mutating command safe; a UUID v4 is recommended. The value
// is sent without quotes. The server scopes the key by caller and operation and fingerprints the
// request by method, path, and body.
//
// Stored for 24 hours after the first request and replayed with the same status, headers, and body:
// the final 2xx outcome and final deterministic 4xx business outcomes of the command, such as 404
// not_found or 409 state_conflict. A replay does not repeat the side effect.
//
// Not stored, so a retry with the same key is evaluated again: 400 validation_failed, 413, and 415 for
// the request itself, 401 and 403, 409 idempotency_in_progress, 412 version_conflict and 428
// precondition_required (nothing changed; read the resource again and retry), 422
// idempotency_key_reused, 429, and every 5xx.
//
// Order of checks: authentication (401), request validation (400, 413, 415), authorization (403), then
// the key. A stored or running request with a different fingerprint returns 422 idempotency_key_reused
// before any other key check; a running request with the same fingerprint returns 409
// idempotency_in_progress; a stored outcome with the same fingerprint is replayed. Only after that
// does the server check If-Match, so a retry of a completed change replays its outcome instead of
// failing on the version it has just changed. After 24 hours the key may be accepted as new.
IdempotencyKey string
}
func unpackCreateOrganizationNeedParams(packed middleware.Parameters) (params CreateOrganizationNeedParams) {
{
key := middleware.ParameterKey{
Name: "org_id",
In: "path",
}
params.OrgID = packed[key].(uuid.UUID)
}
{
key := middleware.ParameterKey{
Name: "Idempotency-Key",
In: "header",
}
params.IdempotencyKey = packed[key].(string)
}
return params
}
func decodeCreateOrganizationNeedParams(args [1]string, argsEscaped bool, r *http.Request) (params CreateOrganizationNeedParams, _ error) {
h := uri.NewHeaderDecoder(r.Header)
// Decode path: org_id.
if err := func() error {
param := args[0]
if argsEscaped {
unescaped, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "org_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.OrgID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "org_id",
In: "path",
Err: err,
}
}
// Decode header: Idempotency-Key.
if err := func() error {
cfg := uri.HeaderParameterDecodingConfig{
Name: "Idempotency-Key",
Explode: false,
}
if err := h.HasParam(cfg); err == nil {
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
params.IdempotencyKey = c
return nil
}); err != nil {
return err
}
if err := func() error {
if err := (validate.String{
MinLength: 1,
MinLengthSet: true,
MaxLength: 255,
MaxLengthSet: true,
Email: false,
Hostname: false,
Regex: regexMap["^[A-Za-z0-9._:-]+$"],
MinNumeric: 0,
MinNumericSet: false,
MaxNumeric: 0,
MaxNumericSet: false,
}).Validate(string(params.IdempotencyKey)); err != nil {
return errors.Wrap(err, "string")
}
return nil
}(); err != nil {
return err
}
} else {
return err
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "Idempotency-Key",
In: "header",
Err: err,
}
}
return params, nil
}
// FinalizeMyAssessmentAttemptParams is parameters of FinalizeMyAssessmentAttempt operation.
type FinalizeMyAssessmentAttemptParams struct {
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
@@ -466,6 +617,363 @@ func decodeGetMyAssessmentResultParams(args [1]string, argsEscaped bool, r *http
return params, nil
}
// GetOrganizationNeedParams is parameters of GetOrganizationNeed operation.
type GetOrganizationNeedParams struct {
// Identifier of an organization. Access comes only from an active membership of the session account in
// this organization, checked by the server on every request; the identifier itself grants nothing. An
// organization without such a membership and an unknown identifier both answer 404 not_found, so
// organizations cannot be enumerated.
OrgID uuid.UUID
// Identifier of a need of the organization in the path. A need of another organization and an unknown
// identifier both answer 404 not_found.
NeedID uuid.UUID
}
func unpackGetOrganizationNeedParams(packed middleware.Parameters) (params GetOrganizationNeedParams) {
{
key := middleware.ParameterKey{
Name: "org_id",
In: "path",
}
params.OrgID = packed[key].(uuid.UUID)
}
{
key := middleware.ParameterKey{
Name: "need_id",
In: "path",
}
params.NeedID = packed[key].(uuid.UUID)
}
return params
}
func decodeGetOrganizationNeedParams(args [2]string, argsEscaped bool, r *http.Request) (params GetOrganizationNeedParams, _ error) {
// Decode path: org_id.
if err := func() error {
param := args[0]
if argsEscaped {
unescaped, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "org_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.OrgID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "org_id",
In: "path",
Err: err,
}
}
// Decode path: need_id.
if err := func() error {
param := args[1]
if argsEscaped {
unescaped, err := url.PathUnescape(args[1])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "need_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.NeedID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "need_id",
In: "path",
Err: err,
}
}
return params, nil
}
// ListOrganizationNeedsParams is parameters of ListOrganizationNeeds operation.
type ListOrganizationNeedsParams struct {
// Identifier of an organization. Access comes only from an active membership of the session account in
// this organization, checked by the server on every request; the identifier itself grants nothing. An
// organization without such a membership and an unknown identifier both answer 404 not_found, so
// organizations cannot be enumerated.
OrgID uuid.UUID
// Maximum number of items in the page. The server may return fewer items even when more remain; use
// `page.has_more` to detect the end.
Limit OptInt32 `json:",omitempty,omitzero"`
// Opaque `page.next_cursor` value from the previous page of the same listing. Omit it to read the
// first page. A malformed or foreign cursor returns 400 with code validation_failed.
Cursor OptString `json:",omitempty,omitzero"`
}
func unpackListOrganizationNeedsParams(packed middleware.Parameters) (params ListOrganizationNeedsParams) {
{
key := middleware.ParameterKey{
Name: "org_id",
In: "path",
}
params.OrgID = packed[key].(uuid.UUID)
}
{
key := middleware.ParameterKey{
Name: "limit",
In: "query",
}
if v, ok := packed[key]; ok {
params.Limit = v.(OptInt32)
}
}
{
key := middleware.ParameterKey{
Name: "cursor",
In: "query",
}
if v, ok := packed[key]; ok {
params.Cursor = v.(OptString)
}
}
return params
}
func decodeListOrganizationNeedsParams(args [1]string, argsEscaped bool, r *http.Request) (params ListOrganizationNeedsParams, _ error) {
q := uri.NewQueryDecoder(r.URL.Query())
// Decode path: org_id.
if err := func() error {
param := args[0]
if argsEscaped {
unescaped, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "org_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.OrgID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "org_id",
In: "path",
Err: err,
}
}
// Set default value for query: limit.
{
val := int32(20)
params.Limit.SetTo(val)
}
// Decode query: limit.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "limit",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotLimitVal int32
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt32(val)
if err != nil {
return err
}
paramsDotLimitVal = c
return nil
}(); err != nil {
return err
}
params.Limit.SetTo(paramsDotLimitVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if value, ok := params.Limit.Get(); ok {
if err := func() error {
if err := (validate.Int{
MinSet: true,
Min: 1,
MaxSet: true,
Max: 100,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
Pattern: nil,
}).Validate(int64(value)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "limit",
In: "query",
Err: err,
}
}
// Decode query: cursor.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "cursor",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotCursorVal string
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
paramsDotCursorVal = c
return nil
}(); err != nil {
return err
}
params.Cursor.SetTo(paramsDotCursorVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if value, ok := params.Cursor.Get(); ok {
if err := func() error {
if err := (validate.String{
MinLength: 1,
MinLengthSet: true,
MaxLength: 512,
MaxLengthSet: true,
Email: false,
Hostname: false,
Regex: regexMap["^[A-Za-z0-9_-]+$"],
MinNumeric: 0,
MinNumericSet: false,
MaxNumeric: 0,
MaxNumericSet: false,
}).Validate(string(value)); err != nil {
return errors.Wrap(err, "string")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "cursor",
In: "query",
Err: err,
}
}
return params, nil
}
// RegisterAccountParams is parameters of RegisterAccount operation.
type RegisterAccountParams struct {
// Client-generated key that makes a retried mutating command safe; a UUID v4 is recommended. The value
@@ -708,3 +1216,127 @@ func decodeSubmitMyAssessmentAnswerParams(args [1]string, argsEscaped bool, r *h
}
return params, nil
}
// UpdateOrganizationNeedParams is parameters of UpdateOrganizationNeed operation.
type UpdateOrganizationNeedParams struct {
// Identifier of an organization. Access comes only from an active membership of the session account in
// this organization, checked by the server on every request; the identifier itself grants nothing. An
// organization without such a membership and an unknown identifier both answer 404 not_found, so
// organizations cannot be enumerated.
OrgID uuid.UUID
// Identifier of a need of the organization in the path. A need of another organization and an unknown
// identifier both answer 404 not_found.
NeedID uuid.UUID
}
func unpackUpdateOrganizationNeedParams(packed middleware.Parameters) (params UpdateOrganizationNeedParams) {
{
key := middleware.ParameterKey{
Name: "org_id",
In: "path",
}
params.OrgID = packed[key].(uuid.UUID)
}
{
key := middleware.ParameterKey{
Name: "need_id",
In: "path",
}
params.NeedID = packed[key].(uuid.UUID)
}
return params
}
func decodeUpdateOrganizationNeedParams(args [2]string, argsEscaped bool, r *http.Request) (params UpdateOrganizationNeedParams, _ error) {
// Decode path: org_id.
if err := func() error {
param := args[0]
if argsEscaped {
unescaped, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "org_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.OrgID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "org_id",
In: "path",
Err: err,
}
}
// Decode path: need_id.
if err := func() error {
param := args[1]
if argsEscaped {
unescaped, err := url.PathUnescape(args[1])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "need_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.NeedID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "need_id",
In: "path",
Err: err,
}
}
return params, nil
}
@@ -172,6 +172,85 @@ func (s *Server) decodeCreateMyAssessmentAttemptRequest(r *http.Request) (
}
}
func (s *Server) decodeCreateOrganizationNeedRequest(r *http.Request) (
req *NeedCreate,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request NeedCreate
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeFinalizeMyAssessmentAttemptRequest(r *http.Request) (
req *AssessmentFinalization,
rawBody []byte,
@@ -645,3 +724,82 @@ func (s *Server) decodeSubmitMyAssessmentAnswerRequest(r *http.Request) (
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeUpdateOrganizationNeedRequest(r *http.Request) (
req *NeedUpdate,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request NeedUpdate
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
@@ -216,6 +216,145 @@ func encodeCreateMyAssessmentAttemptResponse(response CreateMyAssessmentAttemptR
}
}
func encodeCreateOrganizationNeedResponse(response CreateOrganizationNeedRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *NeedHeaders:
w.Header().Set("Content-Type", "application/json; charset=utf-8")
// Encoding response headers.
{
h := uri.NewHeaderEncoder(w.Header())
// Encode "Cache-Control" header.
{
cfg := uri.HeaderParameterEncodingConfig{
Name: "Cache-Control",
Explode: false,
}
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
}); err != nil {
return errors.Wrap(err, "encode Cache-Control header")
}
}
}
w.WriteHeader(201)
e := new(jx.Encoder)
response.Response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *CreateOrganizationNeedBadRequest:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(400)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *CreateOrganizationNeedUnauthorized:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(401)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *CreateOrganizationNeedForbidden:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(403)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *CreateOrganizationNeedNotFound:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(404)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *CreateOrganizationNeedConflict:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(409)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *CreateOrganizationNeedUnprocessableEntity:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(422)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *TooManyRequestsHeaders:
w.Header().Set("Content-Type", "application/problem+json")
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
// Encoding response headers.
{
h := uri.NewHeaderEncoder(w.Header())
// Encode "Retry-After" header.
{
cfg := uri.HeaderParameterEncodingConfig{
Name: "Retry-After",
Explode: false,
}
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
if val, ok := response.RetryAfter.Get(); ok {
return e.EncodeValue(conv.Int32ToString(val))
}
return nil
}); err != nil {
return errors.Wrap(err, "encode Retry-After header")
}
}
}
w.WriteHeader(429)
e := new(jx.Encoder)
response.Response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
default:
return errors.Errorf("unexpected response type: %T", response)
}
}
func encodeFinalizeMyAssessmentAttemptResponse(response FinalizeMyAssessmentAttemptRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *AssessmentAttemptHeaders:
@@ -745,6 +884,89 @@ func encodeGetMyQuestionnaireResponse(response GetMyQuestionnaireRes, w http.Res
}
}
func encodeGetOrganizationNeedResponse(response GetOrganizationNeedRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *NeedHeaders:
w.Header().Set("Content-Type", "application/json; charset=utf-8")
// Encoding response headers.
{
h := uri.NewHeaderEncoder(w.Header())
// Encode "Cache-Control" header.
{
cfg := uri.HeaderParameterEncodingConfig{
Name: "Cache-Control",
Explode: false,
}
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
}); err != nil {
return errors.Wrap(err, "encode Cache-Control header")
}
}
}
w.WriteHeader(200)
e := new(jx.Encoder)
response.Response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *GetOrganizationNeedBadRequest:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(400)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *GetOrganizationNeedUnauthorized:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(401)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *GetOrganizationNeedForbidden:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(403)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *GetOrganizationNeedNotFound:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(404)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
default:
return errors.Errorf("unexpected response type: %T", response)
}
}
func encodeGetSpecializationCatalogResponse(response *SpecializationCatalog, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(200)
@@ -758,6 +980,89 @@ func encodeGetSpecializationCatalogResponse(response *SpecializationCatalog, w h
return nil
}
func encodeListOrganizationNeedsResponse(response ListOrganizationNeedsRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *NeedListHeaders:
w.Header().Set("Content-Type", "application/json; charset=utf-8")
// Encoding response headers.
{
h := uri.NewHeaderEncoder(w.Header())
// Encode "Cache-Control" header.
{
cfg := uri.HeaderParameterEncodingConfig{
Name: "Cache-Control",
Explode: false,
}
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
}); err != nil {
return errors.Wrap(err, "encode Cache-Control header")
}
}
}
w.WriteHeader(200)
e := new(jx.Encoder)
response.Response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *ListOrganizationNeedsBadRequest:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(400)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *ListOrganizationNeedsUnauthorized:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(401)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *ListOrganizationNeedsForbidden:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(403)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *ListOrganizationNeedsNotFound:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(404)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
default:
return errors.Errorf("unexpected response type: %T", response)
}
}
func encodeLoginResponse(response LoginRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *SessionHeaders:
@@ -1352,6 +1657,133 @@ func encodeSubmitMyAssessmentAnswerResponse(response SubmitMyAssessmentAnswerRes
}
}
func encodeUpdateOrganizationNeedResponse(response UpdateOrganizationNeedRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *NeedHeaders:
w.Header().Set("Content-Type", "application/json; charset=utf-8")
// Encoding response headers.
{
h := uri.NewHeaderEncoder(w.Header())
// Encode "Cache-Control" header.
{
cfg := uri.HeaderParameterEncodingConfig{
Name: "Cache-Control",
Explode: false,
}
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
}); err != nil {
return errors.Wrap(err, "encode Cache-Control header")
}
}
}
w.WriteHeader(200)
e := new(jx.Encoder)
response.Response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *UpdateOrganizationNeedBadRequest:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(400)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *UpdateOrganizationNeedUnauthorized:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(401)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *UpdateOrganizationNeedForbidden:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(403)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *UpdateOrganizationNeedNotFound:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(404)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *UpdateOrganizationNeedPreconditionFailed:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(412)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *TooManyRequestsHeaders:
w.Header().Set("Content-Type", "application/problem+json")
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
// Encoding response headers.
{
h := uri.NewHeaderEncoder(w.Header())
// Encode "Retry-After" header.
{
cfg := uri.HeaderParameterEncodingConfig{
Name: "Retry-After",
Explode: false,
}
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
if val, ok := response.RetryAfter.Get(); ok {
return e.EncodeValue(conv.Int32ToString(val))
}
return nil
}); err != nil {
return errors.Wrap(err, "encode Retry-After header")
}
}
}
w.WriteHeader(429)
e := new(jx.Encoder)
response.Response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
default:
return errors.Errorf("unexpected response type: %T", response)
}
}
func encodeErrorResponse(response *ProblemStatusCode, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Content-Type", "application/problem+json")
code := response.StatusCode
@@ -11,32 +11,38 @@ import (
)
var (
rn23AllowedHeaders = map[string]string{
rn28AllowedHeaders = map[string]string{
"POST": "Content-Type",
}
rn1AllowedHeaders = map[string]string{
"POST": "Content-Type",
}
rn21AllowedHeaders = map[string]string{
rn26AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key",
}
rn20AllowedHeaders = map[string]string{
rn25AllowedHeaders = map[string]string{
"POST": "Content-Type",
}
rn11AllowedHeaders = map[string]string{
rn14AllowedHeaders = map[string]string{
"DELETE": "X-Csrf-Token",
}
rn3AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn24AllowedHeaders = map[string]string{
rn29AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn9AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn21AllowedHeaders = map[string]string{
"PUT": "Content-Type,X-Csrf-Token",
}
rn6AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn18AllowedHeaders = map[string]string{
"PUT": "Content-Type,X-Csrf-Token",
rn23AllowedHeaders = map[string]string{
"PATCH": "Content-Type,X-Csrf-Token",
}
)
@@ -70,7 +76,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.notFound(w, r)
return
}
args := [1]string{}
args := [2]string{}
// Static code generated router with unwrapped path search.
switch {
@@ -192,7 +198,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn23AllowedHeaders,
allowedHeaders: rn28AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -269,7 +275,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn21AllowedHeaders,
allowedHeaders: rn26AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -293,7 +299,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn20AllowedHeaders,
allowedHeaders: rn25AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -320,7 +326,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "DELETE,GET",
allowedHeaders: rn11AllowedHeaders,
allowedHeaders: rn14AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
@@ -446,7 +452,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn24AllowedHeaders,
allowedHeaders: rn29AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -473,7 +479,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn6AllowedHeaders,
allowedHeaders: rn9AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -560,7 +566,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,PUT",
allowedHeaders: rn18AllowedHeaders,
allowedHeaders: rn21AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
@@ -571,6 +577,103 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
case 'o': // Prefix: "organizations/"
if l := len("organizations/"); len(elem) >= l && elem[0:l] == "organizations/" {
elem = elem[l:]
} else {
break
}
// Param: "org_id"
// Match until "/"
idx := strings.IndexByte(elem, '/')
if idx < 0 {
idx = len(elem)
}
args[0] = elem[:idx]
elem = elem[idx:]
if len(elem) == 0 {
break
}
switch elem[0] {
case '/': // Prefix: "/needs"
if l := len("/needs"); len(elem) >= l && elem[0:l] == "/needs" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
switch r.Method {
case "GET":
s.handleListOrganizationNeedsRequest([1]string{
args[0],
}, elemIsEscaped, w, r)
case "POST":
s.handleCreateOrganizationNeedRequest([1]string{
args[0],
}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,POST",
allowedHeaders: rn6AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
}
return
}
switch elem[0] {
case '/': // Prefix: "/"
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
elem = elem[l:]
} else {
break
}
// Param: "need_id"
// Leaf parameter, slashes are prohibited
idx := strings.IndexByte(elem, '/')
if idx >= 0 {
break
}
args[1] = elem
elem = ""
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "GET":
s.handleGetOrganizationNeedRequest([2]string{
args[0],
args[1],
}, elemIsEscaped, w, r)
case "PATCH":
s.handleUpdateOrganizationNeedRequest([2]string{
args[0],
args[1],
}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,PATCH",
allowedHeaders: rn23AllowedHeaders,
acceptPost: "",
acceptPatch: "application/json",
})
}
return
}
}
}
case 's': // Prefix: "specializations"
if l := len("specializations"); len(elem) >= l && elem[0:l] == "specializations" {
@@ -611,7 +714,7 @@ type Route struct {
operationGroup string
pathPattern string
count int
args [1]string
args [2]string
}
// Name returns ogen operation name.
@@ -1180,6 +1283,107 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
}
case 'o': // Prefix: "organizations/"
if l := len("organizations/"); len(elem) >= l && elem[0:l] == "organizations/" {
elem = elem[l:]
} else {
break
}
// Param: "org_id"
// Match until "/"
idx := strings.IndexByte(elem, '/')
if idx < 0 {
idx = len(elem)
}
args[0] = elem[:idx]
elem = elem[idx:]
if len(elem) == 0 {
break
}
switch elem[0] {
case '/': // Prefix: "/needs"
if l := len("/needs"); len(elem) >= l && elem[0:l] == "/needs" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
switch method {
case "GET":
r.name = ListOrganizationNeedsOperation
r.summary = "List the needs of an organization."
r.operationID = "ListOrganizationNeeds"
r.operationGroup = ""
r.pathPattern = "/api/v1/organizations/{org_id}/needs"
r.args = args
r.count = 1
return r, true
case "POST":
r.name = CreateOrganizationNeedOperation
r.summary = "Create a need of an organization from a form, a text, or both."
r.operationID = "CreateOrganizationNeed"
r.operationGroup = ""
r.pathPattern = "/api/v1/organizations/{org_id}/needs"
r.args = args
r.count = 1
return r, true
default:
return
}
}
switch elem[0] {
case '/': // Prefix: "/"
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
elem = elem[l:]
} else {
break
}
// Param: "need_id"
// Leaf parameter, slashes are prohibited
idx := strings.IndexByte(elem, '/')
if idx >= 0 {
break
}
args[1] = elem
elem = ""
if len(elem) == 0 {
// Leaf node.
switch method {
case "GET":
r.name = GetOrganizationNeedOperation
r.summary = "Read the current version of a need of an organization."
r.operationID = "GetOrganizationNeed"
r.operationGroup = ""
r.pathPattern = "/api/v1/organizations/{org_id}/needs/{need_id}"
r.args = args
r.count = 2
return r, true
case "PATCH":
r.name = UpdateOrganizationNeedOperation
r.summary = "Confirm, change, or delete requirements of a need."
r.operationID = "UpdateOrganizationNeed"
r.operationGroup = ""
r.pathPattern = "/api/v1/organizations/{org_id}/needs/{need_id}"
r.args = args
r.count = 2
return r, true
default:
return
}
}
}
}
case 's': // Prefix: "specializations"
if l := len("specializations"); len(elem) >= l && elem[0:l] == "specializations" {
File diff suppressed because it is too large. Load diff
@@ -57,6 +57,7 @@ func findAuthorization(h http.Header, prefix string) (string, bool) {
// operationRolesSessionCookie is a private map storing roles per operation.
var operationRolesSessionCookie = map[string][]string{
CreateMyAssessmentAttemptOperation: []string{},
CreateOrganizationNeedOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
GetCurrentAccountOperation: []string{},
GetCurrentSessionOperation: []string{},
@@ -64,9 +65,12 @@ var operationRolesSessionCookie = map[string][]string{
GetMyAssessmentAvailabilityOperation: []string{},
GetMyAssessmentResultOperation: []string{},
GetMyQuestionnaireOperation: []string{},
GetOrganizationNeedOperation: []string{},
ListOrganizationNeedsOperation: []string{},
LogoutOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
}
// GetRolesForSessionCookie returns the required roles for the given operation.
@@ -93,10 +97,12 @@ func GetRolesForSessionCookie(operation string) []string {
// operationRolesSessionCsrf is a private map storing roles per operation.
var operationRolesSessionCsrf = map[string][]string{
CreateMyAssessmentAttemptOperation: []string{},
CreateOrganizationNeedOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
LogoutOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
}
// GetRolesForSessionCsrf returns the required roles for the given operation.
@@ -74,6 +74,59 @@ type Handler interface {
//
// POST /api/v1/me/assessment-attempts
CreateMyAssessmentAttempt(ctx context.Context, req *AssessmentAttemptCreate, params CreateMyAssessmentAttemptParams) (CreateMyAssessmentAttemptRes, error)
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
// token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The organization
// comes from the path and the server-side membership; the body has no organization, membership, or
// role field. In the MVP only the owner of the organization may create a need; the other roles of PRD
// FR07 are planned.
//
// A need does not require a vacancy: `vacancy_id` is optional and nullable. When it is given, it must
// name a vacancy of the same organization; until vacancies exist in the contract, any vacancy
// identifier answers 400 with the pointer `/vacancy_id`, the same for an unknown vacancy and one of
// another organization.
//
// Only `title` is required. A field is sent as a decision `{value, status}` and a list item as
// `{name or text, status}`; on creation the status must be `confirmed`, and the value becomes a
// confirmed manual value. When `source_text` is given, the server extracts suggestions for the absent
// fields with deterministic rules and a dictionary before it answers, so creation works while the ML
// service is disabled; every suggestion has the status `extracted`, the origin extracted_from_text, a
// quote where the extractor found one, and the extractor version, and it waits for a member to confirm
// it. A field that the text does not state stays `unknown` with null value and source; the server
// never guesses a grade, a format, or a salary. ML suggestions with quotes are planned as an
// asynchronous addition that creates a new version and never overwrites a confirmed value.
//
// The need is saved even when critical fields are missing: the response is 201 with version 1, and
// `readiness.missing_fields` names each critical field without a confirmed value with a specific
// question. `recommendations` is computed by the server from the confirmed requirements only; the
// request cannot set a recommendation, its score, or its components. Creating a need never contacts a
// candidate or sends an invitation.
//
// Salary limit: setting a salary range counts against a limit shared by the whole organization, every
// member and every need, on creation as on a change: at most three range settings a day (PRD FR13,
// planned in TASK-211). Over the limit the server answers 429 with Retry-After and creates nothing.
// After five settings within seven days the money component of the recommendations is `withheld` for
// seven days. The limit keeps an organization from probing hidden candidate minimums with new needs
// instead of edits; repeated range changes also feed the private risk signals of TASK-319.
//
// Idempotency: a retry with the same key and body within 24 hours replays the stored 201 and creates
// nothing, so a lost response never creates a second need. A different body with the same key answers
// 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a
// pointer: `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose
// width is outside 10-40%, `/required_skills/1/name` for a repeated skill, `/grade/status` or
// `/required_skills/0/status` for `extracted`, which a new need cannot have, or `/vacancy_id`), then
// the salary limit (429). The schema already rejects unknown fields such as `rec_score`, `members`, or
// `candidate_minimum`, a field sent as a bare value instead of `{value, status}`, a salary bound that
// is not a positive multiple of 1000, and an unknown currency, period, or tax basis. The general rate
// limit can answer 429 with Retry-After before any check. 429 is never stored.
//
// POST /api/v1/organizations/{org_id}/needs
CreateOrganizationNeed(ctx context.Context, req *NeedCreate, params CreateOrganizationNeedParams) (CreateOrganizationNeedRes, error)
// FinalizeMyAssessmentAttempt implements FinalizeMyAssessmentAttempt operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -234,6 +287,37 @@ type Handler interface {
//
// GET /api/v1/me/questionnaire
GetMyQuestionnaire(ctx context.Context) (GetMyQuestionnaireRes, error)
// GetOrganizationNeed implements GetOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the server-side membership, never from the request. In the MVP
// only the owner of the organization reads needs; the other roles of PRD FR07 are planned.
//
// Returns the current version of the need: `version`, the requirements with the confirmation state and
// provenance of each field (`status`, and `source` with the origin, the quote, the version whose text
// the quote belongs to, and the extractor version), the readiness with `missing_fields`, and the
// category recommendations of the server. A field with status `unknown` has null value and source; an
// `extracted` value is a suggestion that waits for confirmation and never feeds search or
// recommendations.
//
// Versions: every committed change creates a new immutable `version`, and this operation always
// returns the latest one. `requirements_version` is the version in which the confirmed requirements
// were last changed; a change of the title, the vacancy link, the text, or suggestions only keeps it.
// Search runs, selection snapshots, and invitations refer to a need by its identifier and
// `requirements_version`, so they keep the requirements they used, and only a new
// `requirements_version` calls for a new selection snapshot. Reading and comparing earlier versions
// (PRD FR10) are planned as separate operations that return the same NeedRequirementSet for a given
// version; they add no field here.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
// account answers 403 forbidden; an account without an active membership in the organization, an
// unknown organization, an unknown need, and a need of another organization all answer 404 not_found,
// so identifiers cannot be probed; a member whose role does not allow reading the need answers 403
// forbidden. An `org_id` or `need_id` that is not a UUID answers 400 validation_failed with the path
// pointer.
//
// GET /api/v1/organizations/{org_id}/needs/{need_id}
GetOrganizationNeed(ctx context.Context, params GetOrganizationNeedParams) (GetOrganizationNeedRes, error)
// GetSpecializationCatalog implements GetSpecializationCatalog operation.
//
// Public operation without a session. Returns the directions with their specializations, the
@@ -254,6 +338,27 @@ type Handler interface {
//
// GET /api/v1/specializations
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the membership that the server holds for the session account,
// never from the request. In the MVP only the owner of the organization works with needs; the other
// roles of the PRD FR07 matrix (recruiter, hiring manager and technical expert for assigned needs) are
// planned and change no field of this contract. The list holds only the needs that the role may read.
//
// Returns a page of need summaries, newest first by creation time with the identifier as the
// tie-breaker, with cursor pagination. A summary has the current version, the target specialization
// and grade with their confirmation state, and the readiness; GetOrganizationNeed returns the
// requirements and the recommendations.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
// account answers 403 forbidden; an account without an active membership in the organization and an
// unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member
// whose role does not allow reading needs answers 403 forbidden. A malformed `org_id`, `limit`, or
// `cursor` answers 400 validation_failed.
//
// GET /api/v1/organizations/{org_id}/needs
ListOrganizationNeeds(ctx context.Context, params ListOrganizationNeedsParams) (ListOrganizationNeedsRes, error)
// Login implements Login operation.
//
// Public operation that starts a server session. The server verifies the password with Argon2id; for
@@ -441,6 +546,73 @@ type Handler interface {
//
// POST /api/v1/me/assessment-attempts/{attempt_id}/answers
SubmitMyAssessmentAnswer(ctx context.Context, req *AssessmentAnswerSubmission, params SubmitMyAssessmentAnswerParams) (SubmitMyAssessmentAnswerRes, error)
// UpdateOrganizationNeed implements UpdateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
// token of that session in X-CSRF-Token, and an allowed Origin. The organization and the role come
// from the server-side membership; the body has no organization, membership, or role field. In the MVP
// only the owner of the organization changes needs; the technical expert, who may refine the
// requirements of assigned needs under PRD FR07, is planned.
//
// Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch.
// Each field present replaces that field as a whole and an absent field stays unchanged; a field
// decision and each list are replaced entirely and never merged. This keeps every field one optional
// value in the generated server and client, without nested partial updates.
//
// Each requirement field is sent as a decision `{value, status}` and each list item as
// `{name or text, status}`, so confirmation is always explicit:
//
// - Confirm a suggestion: send its stored value with `confirmed`. It keeps its origin and quote.
// - Keep a suggestion open: send its stored value with `extracted`, or leave the field out.
// `extracted` with any other value, or for a field or item without a stored suggestion, answers 400
// with the pointer of that `status`, for example `/grade/status` or `/required_skills/2/status`. A
// client that sends back an unchanged form therefore never confirms a suggestion by accident.
// - Change: send another value with `confirmed`. It becomes a confirmed manual value, and its quote
// is dropped.
// - Delete: send null for a nullable field, which makes it `unknown` (or unlinks `vacancy_id`), or
// leave the item out of a skill or task list, which deletes it. An empty skill or task list deletes
// every item; a list sent as null answers 400. A deleted requirement really changes the
// requirements that search uses, not only an explanation, and a deleted suggestion is not proposed
// again by a later extraction.
// - Text: a different `source_text` extracts again. New suggestions replace only the `extracted`
// values and items of the fields not named in the body; confirmed values are never overwritten, and
// a suggested skill whose name is already in either skill list is skipped. Null removes the text
// and keeps every value.
//
// Versions: every committed change creates version `expected_version + 1` as an immutable snapshot and
// answers 200 with it. `requirements_version` becomes the new version only when a confirmed
// requirement was confirmed, changed, or removed. `expected_version` is the `version` the client read;
// when it is not current, the server answers 412 version_conflict and changes nothing, and the client
// reads the need again and reapplies its unsaved edits. The version travels in the body rather than in
// If-Match because the generated client cannot read the ETag response header yet, as for the
// questionnaire. Concurrent changes therefore never overwrite each other silently.
//
// The operation needs no Idempotency-Key: a body that changes nothing when applied to the current
// version, such as a retry of a change that already succeeded, keeps the version and answers 200 with
// the current need even when `expected_version` is older. An incomplete need is a valid result;
// `readiness.missing_fields` tells what remains.
//
// Salary limit: the recommendations aggregate candidates' minimums against the upper bound, so setting
// or changing a confirmed salary range counts against a limit shared by the whole organization, every
// member and every need, together with ranges set on creation: at most three a day (PRD FR13, planned
// in TASK-211). Over the limit the server answers 429 with Retry-After and changes nothing. After five
// settings within seven days the money component is `withheld` for seven days. Repeated range changes
// also feed the private risk signals of TASK-319.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the need (404 not_found), a body that changes nothing (200), the version (412), domain
// rules (400 with a pointer such as `/salary/value/salary_to` for a range whose lower bound is not
// below the upper one or whose width is outside 10-40%, `/desired_skills/0/name` for a skill that is
// also in the required list, `/grade/status` or `/required_skills/2/status` for `extracted` with a
// value that is not the stored suggestion, or `/vacancy_id`), then the salary change limit (429). The
// schema rejects a missing or non-positive `expected_version`, unknown fields such as `rec_score`,
// `members`, `candidate_minimum`, or `version`, a field sent as a bare value instead of
// `{value, status}`, a list sent as null, a salary bound that is not a positive multiple of 1000, and
// an unknown currency, period, or tax basis.
//
// PATCH /api/v1/organizations/{org_id}/needs/{need_id}
UpdateOrganizationNeed(ctx context.Context, req *NeedUpdate, params UpdateOrganizationNeedParams) (UpdateOrganizationNeedRes, error)
// NewError creates *ProblemStatusCode from error returned by handler.
//
// Used for common default response.
@@ -85,6 +85,62 @@ func (UnimplementedHandler) CreateMyAssessmentAttempt(ctx context.Context, req *
return r, ht.ErrNotImplemented
}
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
// token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The organization
// comes from the path and the server-side membership; the body has no organization, membership, or
// role field. In the MVP only the owner of the organization may create a need; the other roles of PRD
// FR07 are planned.
//
// A need does not require a vacancy: `vacancy_id` is optional and nullable. When it is given, it must
// name a vacancy of the same organization; until vacancies exist in the contract, any vacancy
// identifier answers 400 with the pointer `/vacancy_id`, the same for an unknown vacancy and one of
// another organization.
//
// Only `title` is required. A field is sent as a decision `{value, status}` and a list item as
// `{name or text, status}`; on creation the status must be `confirmed`, and the value becomes a
// confirmed manual value. When `source_text` is given, the server extracts suggestions for the absent
// fields with deterministic rules and a dictionary before it answers, so creation works while the ML
// service is disabled; every suggestion has the status `extracted`, the origin extracted_from_text, a
// quote where the extractor found one, and the extractor version, and it waits for a member to confirm
// it. A field that the text does not state stays `unknown` with null value and source; the server
// never guesses a grade, a format, or a salary. ML suggestions with quotes are planned as an
// asynchronous addition that creates a new version and never overwrites a confirmed value.
//
// The need is saved even when critical fields are missing: the response is 201 with version 1, and
// `readiness.missing_fields` names each critical field without a confirmed value with a specific
// question. `recommendations` is computed by the server from the confirmed requirements only; the
// request cannot set a recommendation, its score, or its components. Creating a need never contacts a
// candidate or sends an invitation.
//
// Salary limit: setting a salary range counts against a limit shared by the whole organization, every
// member and every need, on creation as on a change: at most three range settings a day (PRD FR13,
// planned in TASK-211). Over the limit the server answers 429 with Retry-After and creates nothing.
// After five settings within seven days the money component of the recommendations is `withheld` for
// seven days. The limit keeps an organization from probing hidden candidate minimums with new needs
// instead of edits; repeated range changes also feed the private risk signals of TASK-319.
//
// Idempotency: a retry with the same key and body within 24 hours replays the stored 201 and creates
// nothing, so a lost response never creates a second need. A different body with the same key answers
// 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a
// pointer: `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose
// width is outside 10-40%, `/required_skills/1/name` for a repeated skill, `/grade/status` or
// `/required_skills/0/status` for `extracted`, which a new need cannot have, or `/vacancy_id`), then
// the salary limit (429). The schema already rejects unknown fields such as `rec_score`, `members`, or
// `candidate_minimum`, a field sent as a bare value instead of `{value, status}`, a salary bound that
// is not a positive multiple of 1000, and an unknown currency, period, or tax basis. The general rate
// limit can answer 429 with Retry-After before any check. 429 is never stored.
//
// POST /api/v1/organizations/{org_id}/needs
func (UnimplementedHandler) CreateOrganizationNeed(ctx context.Context, req *NeedCreate, params CreateOrganizationNeedParams) (r CreateOrganizationNeedRes, _ error) {
return r, ht.ErrNotImplemented
}
// FinalizeMyAssessmentAttempt implements FinalizeMyAssessmentAttempt operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -272,6 +328,40 @@ func (UnimplementedHandler) GetMyQuestionnaire(ctx context.Context) (r GetMyQues
return r, ht.ErrNotImplemented
}
// GetOrganizationNeed implements GetOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the server-side membership, never from the request. In the MVP
// only the owner of the organization reads needs; the other roles of PRD FR07 are planned.
//
// Returns the current version of the need: `version`, the requirements with the confirmation state and
// provenance of each field (`status`, and `source` with the origin, the quote, the version whose text
// the quote belongs to, and the extractor version), the readiness with `missing_fields`, and the
// category recommendations of the server. A field with status `unknown` has null value and source; an
// `extracted` value is a suggestion that waits for confirmation and never feeds search or
// recommendations.
//
// Versions: every committed change creates a new immutable `version`, and this operation always
// returns the latest one. `requirements_version` is the version in which the confirmed requirements
// were last changed; a change of the title, the vacancy link, the text, or suggestions only keeps it.
// Search runs, selection snapshots, and invitations refer to a need by its identifier and
// `requirements_version`, so they keep the requirements they used, and only a new
// `requirements_version` calls for a new selection snapshot. Reading and comparing earlier versions
// (PRD FR10) are planned as separate operations that return the same NeedRequirementSet for a given
// version; they add no field here.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
// account answers 403 forbidden; an account without an active membership in the organization, an
// unknown organization, an unknown need, and a need of another organization all answer 404 not_found,
// so identifiers cannot be probed; a member whose role does not allow reading the need answers 403
// forbidden. An `org_id` or `need_id` that is not a UUID answers 400 validation_failed with the path
// pointer.
//
// GET /api/v1/organizations/{org_id}/needs/{need_id}
func (UnimplementedHandler) GetOrganizationNeed(ctx context.Context, params GetOrganizationNeedParams) (r GetOrganizationNeedRes, _ error) {
return r, ht.ErrNotImplemented
}
// GetSpecializationCatalog implements GetSpecializationCatalog operation.
//
// Public operation without a session. Returns the directions with their specializations, the
@@ -295,6 +385,30 @@ func (UnimplementedHandler) GetSpecializationCatalog(ctx context.Context) (r *Sp
return r, ht.ErrNotImplemented
}
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the membership that the server holds for the session account,
// never from the request. In the MVP only the owner of the organization works with needs; the other
// roles of the PRD FR07 matrix (recruiter, hiring manager and technical expert for assigned needs) are
// planned and change no field of this contract. The list holds only the needs that the role may read.
//
// Returns a page of need summaries, newest first by creation time with the identifier as the
// tie-breaker, with cursor pagination. A summary has the current version, the target specialization
// and grade with their confirmation state, and the readiness; GetOrganizationNeed returns the
// requirements and the recommendations.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
// account answers 403 forbidden; an account without an active membership in the organization and an
// unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member
// whose role does not allow reading needs answers 403 forbidden. A malformed `org_id`, `limit`, or
// `cursor` answers 400 validation_failed.
//
// GET /api/v1/organizations/{org_id}/needs
func (UnimplementedHandler) ListOrganizationNeeds(ctx context.Context, params ListOrganizationNeedsParams) (r ListOrganizationNeedsRes, _ error) {
return r, ht.ErrNotImplemented
}
// Login implements Login operation.
//
// Public operation that starts a server session. The server verifies the password with Argon2id; for
@@ -500,6 +614,76 @@ func (UnimplementedHandler) SubmitMyAssessmentAnswer(ctx context.Context, req *A
return r, ht.ErrNotImplemented
}
// UpdateOrganizationNeed implements UpdateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
// token of that session in X-CSRF-Token, and an allowed Origin. The organization and the role come
// from the server-side membership; the body has no organization, membership, or role field. In the MVP
// only the owner of the organization changes needs; the technical expert, who may refine the
// requirements of assigned needs under PRD FR07, is planned.
//
// Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch.
// Each field present replaces that field as a whole and an absent field stays unchanged; a field
// decision and each list are replaced entirely and never merged. This keeps every field one optional
// value in the generated server and client, without nested partial updates.
//
// Each requirement field is sent as a decision `{value, status}` and each list item as
// `{name or text, status}`, so confirmation is always explicit:
//
// - Confirm a suggestion: send its stored value with `confirmed`. It keeps its origin and quote.
// - Keep a suggestion open: send its stored value with `extracted`, or leave the field out.
// `extracted` with any other value, or for a field or item without a stored suggestion, answers 400
// with the pointer of that `status`, for example `/grade/status` or `/required_skills/2/status`. A
// client that sends back an unchanged form therefore never confirms a suggestion by accident.
// - Change: send another value with `confirmed`. It becomes a confirmed manual value, and its quote
// is dropped.
// - Delete: send null for a nullable field, which makes it `unknown` (or unlinks `vacancy_id`), or
// leave the item out of a skill or task list, which deletes it. An empty skill or task list deletes
// every item; a list sent as null answers 400. A deleted requirement really changes the
// requirements that search uses, not only an explanation, and a deleted suggestion is not proposed
// again by a later extraction.
// - Text: a different `source_text` extracts again. New suggestions replace only the `extracted`
// values and items of the fields not named in the body; confirmed values are never overwritten, and
// a suggested skill whose name is already in either skill list is skipped. Null removes the text
// and keeps every value.
//
// Versions: every committed change creates version `expected_version + 1` as an immutable snapshot and
// answers 200 with it. `requirements_version` becomes the new version only when a confirmed
// requirement was confirmed, changed, or removed. `expected_version` is the `version` the client read;
// when it is not current, the server answers 412 version_conflict and changes nothing, and the client
// reads the need again and reapplies its unsaved edits. The version travels in the body rather than in
// If-Match because the generated client cannot read the ETag response header yet, as for the
// questionnaire. Concurrent changes therefore never overwrite each other silently.
//
// The operation needs no Idempotency-Key: a body that changes nothing when applied to the current
// version, such as a retry of a change that already succeeded, keeps the version and answers 200 with
// the current need even when `expected_version` is older. An incomplete need is a valid result;
// `readiness.missing_fields` tells what remains.
//
// Salary limit: the recommendations aggregate candidates' minimums against the upper bound, so setting
// or changing a confirmed salary range counts against a limit shared by the whole organization, every
// member and every need, together with ranges set on creation: at most three a day (PRD FR13, planned
// in TASK-211). Over the limit the server answers 429 with Retry-After and changes nothing. After five
// settings within seven days the money component is `withheld` for seven days. Repeated range changes
// also feed the private risk signals of TASK-319.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the need (404 not_found), a body that changes nothing (200), the version (412), domain
// rules (400 with a pointer such as `/salary/value/salary_to` for a range whose lower bound is not
// below the upper one or whose width is outside 10-40%, `/desired_skills/0/name` for a skill that is
// also in the required list, `/grade/status` or `/required_skills/2/status` for `extracted` with a
// value that is not the stored suggestion, or `/vacancy_id`), then the salary change limit (429). The
// schema rejects a missing or non-positive `expected_version`, unknown fields such as `rec_score`,
// `members`, `candidate_minimum`, or `version`, a field sent as a bare value instead of
// `{value, status}`, a list sent as null, a salary bound that is not a positive multiple of 1000, and
// an unknown currency, period, or tax basis.
//
// PATCH /api/v1/organizations/{org_id}/needs/{need_id}
func (UnimplementedHandler) UpdateOrganizationNeed(ctx context.Context, req *NeedUpdate, params UpdateOrganizationNeedParams) (r UpdateOrganizationNeedRes, _ error) {
return r, ht.ErrNotImplemented
}
// NewError creates *ProblemStatusCode from error returned by handler.
//
// Used for common default response.
File diff suppressed because it is too large. Load diff
@@ -756,6 +756,330 @@ func TestAssessmentAccessBeforeImplementation(t *testing.T) {
}
}
// Need request fixtures shared by the need tests.
const (
organizationNeedsPath = "/api/v1/organizations/01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01/needs"
organizationNeedPath = organizationNeedsPath + "/01928f7a-2b3c-7d4e-9f5a-6b7c8d9e0f12"
netSalaryRange = `{"salary_from":120000,"salary_to":160000,"currency":"RUB","period":"month","tax_basis":"net"}`
validNeedCreate = `{"title":"Backend","specialization":{"value":"backend","status":"confirmed"},` +
`"grade":{"value":"junior","status":"confirmed"},"required_skills":[{"name":"Go","status":"confirmed"}],` +
`"work_formats":{"value":["remote"],"status":"confirmed"},"salary":{"value":` + netSalaryRange + `,"status":"confirmed"}}`
)
// needUpdateBody returns an UpdateOrganizationNeed body over version 1 with
// the given extra fields, for example `"grade":null`.
func needUpdateBody(fields string) string {
return `{"expected_version":1,` + fields + `}`
}
// needSalary returns a confirmed salary decision for the given range bounds
// and tax basis in RUB per month.
func needSalary(from, to, basis string) string {
return `{"value":{"salary_from":` + from + `,"salary_to":` + to + `,"currency":"RUB","period":"month","tax_basis":"` + basis + `"},"status":"confirmed"}`
}
// The schema alone must accept a need without a vacancy and reject what an
// employer may never send: membership, a recommendation score, or a
// candidate's minimum, a bare value without an explicit confirmation status,
// a salary range without a valid RUB base, and a missing or invalid
// expected_version. Security accepts the session here, so the request
// reaches validation; a valid request then answers 501 until needs are
// implemented. Cross-field salary rules (A < B, a width of 10-40%) and
// `extracted` with another value pass the schema; the server rejects them.
func TestNeedSchemaValidationPrecedesImplementation(t *testing.T) {
session := map[string]string{"Cookie": testSessionCookie, "X-CSRF-Token": testCSRFToken}
command := map[string]string{"Cookie": testSessionCookie, "X-CSRF-Token": testCSRFToken, "Idempotency-Key": testIdempotencyKey}
create := func(body string) identityRequest {
return identityRequest{method: http.MethodPost, path: organizationNeedsPath, body: body, headers: command}
}
update := func(fields string) identityRequest {
return identityRequest{method: http.MethodPatch, path: organizationNeedPath, body: needUpdateBody(fields), headers: session}
}
withSalary := func(salary string) string {
return strings.Replace(validNeedCreate, `{"value":`+netSalaryRange+`,"status":"confirmed"}`, salary, 1)
}
for _, test := range []struct {
name string
request identityRequest
location api.ProblemFieldLocation
pointer string
code string
}{
{
name: "list",
request: identityRequest{method: http.MethodGet, path: organizationNeedsPath + "?limit=20", headers: session},
},
{
name: "list with a limit above the maximum",
request: identityRequest{method: http.MethodGet, path: organizationNeedsPath + "?limit=101", headers: session},
location: api.ProblemFieldLocationQuery, pointer: "/limit", code: "invalid",
},
{
name: "list for an organization identifier that is not a UUID",
request: identityRequest{method: http.MethodGet, path: "/api/v1/organizations/acme/needs", headers: session},
location: api.ProblemFieldLocationPath, pointer: "/org_id", code: "invalid",
},
{
name: "create a manual need without a vacancy",
request: create(validNeedCreate),
},
{
name: "create from a text only",
request: create(`{"title":"Backend","source_text":"Ищем бэкенд-разработчика. Обязательно: Go."}`),
},
{
name: "create with an explicit null vacancy and unknown fields",
request: create(`{"title":"Backend","vacancy_id":null,"grade":null,"salary":null,"work_formats":null,"tasks":[]}`),
},
{
// The cross-field salary rules are domain rules that the server
// checks after the schema.
name: "create with a reversed salary range",
request: create(withSalary(needSalary("160000", "120000", "net"))),
},
{
name: "create with equal salary bounds",
request: create(withSalary(needSalary("150000", "150000", "net"))),
},
{
name: "create with a salary range wider than 40%",
request: create(withSalary(needSalary("100000", "200000", "net"))),
},
{
name: "create without a title",
request: create(`{"specialization":{"value":"backend","status":"confirmed"}}`),
location: api.ProblemFieldLocationBody, pointer: "/title", code: "required",
},
{
name: "create without an Idempotency-Key",
request: identityRequest{method: http.MethodPost, path: organizationNeedsPath, body: validNeedCreate, headers: session},
location: api.ProblemFieldLocationHeader, pointer: "/Idempotency-Key", code: "required",
},
{
name: "salary bound of zero",
request: create(withSalary(needSalary("0", "160000", "net"))),
location: api.ProblemFieldLocationBody, pointer: "/salary/value/salary_from", code: "invalid",
},
{
name: "salary bound that is not a multiple of 1000",
request: create(withSalary(needSalary("120000", "160500", "net"))),
location: api.ProblemFieldLocationBody, pointer: "/salary/value/salary_to", code: "invalid",
},
{
name: "salary in another currency",
request: create(withSalary(strings.Replace(needSalary("120000", "160000", "net"), "RUB", "USD", 1))),
location: api.ProblemFieldLocationBody, pointer: "/salary/value/currency", code: "invalid",
},
{
name: "salary with an unknown tax basis",
request: create(withSalary(needSalary("120000", "160000", "after_tax"))),
location: api.ProblemFieldLocationBody, pointer: "/salary/value/tax_basis", code: "invalid",
},
{
name: "salary per hour",
request: create(withSalary(strings.Replace(needSalary("1000", "2000", "net"), "month", "hour", 1))),
location: api.ProblemFieldLocationBody, pointer: "/salary/value/period", code: "invalid",
},
{
// The decoder does not record the path of a missing field in a
// nested object, so the pointer is the whole body.
name: "salary without a tax basis",
request: create(withSalary(`{"value":{"salary_from":120000,"salary_to":160000,"currency":"RUB","period":"month"},"status":"confirmed"}`)),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
// A bare range would confirm it implicitly; the status is explicit.
name: "salary range without a decision",
request: create(withSalary(netSalaryRange)),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "grade as a bare value",
request: create(strings.Replace(validNeedCreate, `{"value":"junior","status":"confirmed"}`, `"junior"`, 1)),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "grade with an unknown status",
request: create(strings.Replace(validNeedCreate, `{"value":"junior","status":"confirmed"}`, `{"value":"junior","status":"unknown"}`, 1)),
location: api.ProblemFieldLocationBody, pointer: "/grade/status", code: "invalid",
},
{
name: "recommendation score set by the employer",
request: create(strings.Replace(validNeedCreate, `{"title"`, `{"rec_score":0.99,"title"`, 1)),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "organization membership in the body",
request: create(strings.Replace(validNeedCreate, `{"title"`, `{"members":[{"user_id":"01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01","role":"owner"}],"title"`, 1)),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "candidate minimum inside the salary range",
request: create(withSalary(`{"value":{"salary_from":120000,"salary_to":160000,"currency":"RUB","period":"month","tax_basis":"net","candidate_minimum":130000},"status":"confirmed"}`)),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "skill with an unknown status",
request: create(strings.Replace(validNeedCreate, `{"name":"Go","status":"confirmed"}`, `{"name":"Go","status":"unknown"}`, 1)),
location: api.ProblemFieldLocationBody, pointer: "/required_skills/0/status", code: "invalid",
},
{
name: "empty list of work formats",
request: create(strings.Replace(validNeedCreate, `["remote"]`, `[]`, 1)),
location: api.ProblemFieldLocationBody, pointer: "/work_formats/value", code: "invalid",
},
{
name: "read",
request: identityRequest{method: http.MethodGet, path: organizationNeedPath, headers: session},
},
{
name: "read with a need identifier that is not a UUID",
request: identityRequest{method: http.MethodGet, path: organizationNeedsPath + "/1", headers: session},
location: api.ProblemFieldLocationPath, pointer: "/need_id", code: "invalid",
},
{
name: "confirm suggestions, keep two open, and answer missing fields",
request: update(`"specialization":{"value":"backend","status":"confirmed"},"grade":{"value":"middle","status":"confirmed"},` +
`"required_skills":[{"name":"Go","status":"confirmed"},{"name":"Temporal","status":"confirmed"}],` +
`"desired_skills":[{"name":"Kafka","status":"extracted"}],"domain":{"value":"платежи","status":"extracted"},` +
`"salary":` + needSalary("250000", "320000", "gross")),
},
{
name: "delete requirements",
request: update(`"grade":null,"salary":null,"vacancy_id":null,"tasks":[]`),
},
{
name: "update with a list sent as null",
request: update(`"tasks":null`),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "update with a bare grade",
request: update(`"grade":"middle"`),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "update without an expected version",
request: identityRequest{method: http.MethodPatch, path: organizationNeedPath, body: `{"grade":null}`, headers: session},
location: api.ProblemFieldLocationBody, pointer: "/expected_version", code: "required",
},
{
name: "update with version zero",
request: identityRequest{method: http.MethodPatch, path: organizationNeedPath, body: `{"expected_version":0,"grade":null}`, headers: session},
location: api.ProblemFieldLocationBody, pointer: "/expected_version", code: "invalid",
},
{
name: "update with a version as text",
request: identityRequest{method: http.MethodPatch, path: organizationNeedPath, body: `{"expected_version":"1","grade":null}`, headers: session},
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "update that sets the version itself",
request: update(`"version":7`),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "update that sets the requirements version",
request: update(`"requirements_version":7`),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "update with recommendations",
request: update(`"recommendations":{"status":"computed"}`),
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "update with a salary in gross and net at once",
request: update(`"salary":` + needSalary("120000", "160000", "net_or_gross")),
location: api.ProblemFieldLocationBody, pointer: "/salary/value/tax_basis", code: "invalid",
},
{
name: "update with a negative salary bound",
request: update(`"salary":` + needSalary("-1000", "160000", "gross")),
location: api.ProblemFieldLocationBody, pointer: "/salary/value/salary_from", code: "invalid",
},
} {
t.Run(test.name, func(t *testing.T) {
logger := slog.New(slog.DiscardHandler)
healthHandler := newTestHealthHandler(func(context.Context) error { return nil })
router, err := NewRouter(healthHandler, v1.NewHandler(healthHandler, problem.NewResponder(logger)), &recordingSecurity{}, problem.NewResponder(logger), metrics.New(), logger)
if err != nil {
t.Fatalf("NewRouter() error = %v", err)
}
response := serveIdentityRequest(t, router, test.request)
if test.code == "" {
requireProblem(t, response, http.StatusNotImplemented, api.ProblemCodeNotImplemented)
return
}
body := requireProblem(t, response, http.StatusBadRequest, api.ProblemCodeValidationFailed)
want := api.ProblemFieldError{In: test.location, Pointer: test.pointer, Code: test.code}
for _, field := range body.Errors {
if field.In == want.In && field.Pointer == want.Pointer && field.Code == want.Code {
return
}
}
t.Fatalf("errors = %+v, want an entry %+v", body.Errors, want)
})
}
}
// A non-nullable optional list decodes to a plain slice, so an
// UpdateOrganizationNeed handler tells an absent list (unchanged) from an
// empty one (delete every item) only by nil; null is not a list and fails.
func TestNeedUpdateDecodingKeepsAbsentAndEmptyListsApart(t *testing.T) {
var empty api.NeedUpdate
if err := empty.UnmarshalJSON([]byte(`{"expected_version":1,"tasks":[]}`)); err != nil {
t.Fatalf("decode an empty list: %v", err)
}
if empty.Tasks == nil || len(empty.Tasks) != 0 {
t.Fatalf("tasks = %#v, want a non-nil empty slice", empty.Tasks)
}
var absent api.NeedUpdate
if err := absent.UnmarshalJSON([]byte(`{"expected_version":1}`)); err != nil {
t.Fatalf("decode an absent list: %v", err)
}
if absent.Tasks != nil || absent.RequiredSkills != nil || absent.DesiredSkills != nil {
t.Fatalf("lists = %#v %#v %#v, want nil for absent fields", absent.Tasks, absent.RequiredSkills, absent.DesiredSkills)
}
if absent.Grade.IsSet() || absent.Salary.IsSet() {
t.Fatal("absent field decisions are set, want unset")
}
var cleared api.NeedUpdate
if err := cleared.UnmarshalJSON([]byte(`{"expected_version":1,"grade":null}`)); err != nil {
t.Fatalf("decode a null field decision: %v", err)
}
if !cleared.Grade.IsSet() || !cleared.Grade.IsNull() {
t.Fatal("grade sent as null is not a set null, want a removal")
}
var null api.NeedUpdate
if err := null.UnmarshalJSON([]byte(`{"expected_version":1,"tasks":null}`)); err == nil {
t.Fatal("decode a list sent as null succeeded, want an error")
}
}
// Every need operation requires an employer session; DenyAllSecurity grants
// none, with or without a cookie and a CSRF token.
func TestNeedAccessBeforeImplementation(t *testing.T) {
session := map[string]string{"Cookie": testSessionCookie, "X-CSRF-Token": testCSRFToken}
command := map[string]string{"Cookie": testSessionCookie, "X-CSRF-Token": testCSRFToken, "Idempotency-Key": testIdempotencyKey}
for _, test := range []identityRequest{
{method: http.MethodGet, path: organizationNeedsPath},
{method: http.MethodGet, path: organizationNeedsPath, headers: map[string]string{"Cookie": testSessionCookie}},
{method: http.MethodPost, path: organizationNeedsPath, body: validNeedCreate, headers: command},
{method: http.MethodGet, path: organizationNeedPath},
{method: http.MethodPatch, path: organizationNeedPath, body: needUpdateBody(`"grade":{"value":"middle","status":"confirmed"}`), headers: session},
} {
t.Run(test.method+" "+test.path, func(t *testing.T) {
router := newTestRouter(t, func(context.Context) error { return nil })
requireProblem(t, serveIdentityRequest(t, router, test), http.StatusUnauthorized, api.ProblemCodeUnauthenticated)
})
}
}
func TestPublicOperationInternalErrorIsLoggedButNotExposed(t *testing.T) {
var logs bytes.Buffer
logger := slog.New(slog.NewJSONHandler(&logs, nil))
+1 -1
View File
@@ -338,7 +338,7 @@ Candidate flow: verify email -> complete profile and consent -> answer questionn
Employer flow: verify email -> create company profile -> describe need -> confirm extracted skills -> choose filters -> review an explainable result set -> send a salary offer -> candidate accepts -> only that company can access contacts.
An invitation includes the employer, description, contact channel, both salary bounds, and RUB currency. Both salary values are required and must satisfy 0 < salary_from <= salary_to. Show the pay period and tax basis. vacancy_id is optional. Main transitions are sent -> viewed -> accepted or declined; direct acceptance from sent is allowed. withdrawn and expired are additional states. Retries are idempotent, and transactions protect concurrent state changes.
An invitation includes the employer, description, contact channel, both salary bounds, and RUB currency. Both salary values are required whole rubles in multiples of 1000 and must satisfy 0 < salary_from < salary_to, with a width (salary_to - salary_from) / ((salary_from + salary_to) / 2) from 10% to 40% inclusive (PRD FR13); the same rule applies to the salary range of a need. Show the pay period and tax basis (net or gross). vacancy_id is optional. Main transitions are sent -> viewed -> accepted or declined; direct acceptance from sent is allowed. withdrawn and expired are additional states. Retries are idempotent, and transactions protect concurrent state changes.
A contact grant belongs to one candidate-company pair and is created after an accepted invitation or a candidate's own application. The server checks the user, company membership, grant, and current visibility on each read. Before a grant, employers receive no contacts, original PDF, messaging links, or contact fragments from resumes or ML.
+1 -1
View File
@@ -338,7 +338,7 @@ backend/
Целевой сценарий работодателя: подтверждение email -> профиль компании -> описание потребности -> выбор или подтверждение извлеченных навыков -> фильтры и объяснимая подборка -> предложение с диапазоном зарплаты -> принятие кандидатом -> контактный доступ только этой компании.
Приглашение содержит работодателя, описание, способ связи, обе границы зарплаты и валюту RUB. 0 < salary_from <= salary_to; период и налоги показываются явно. vacancy_id необязателен. Базовые переходы: sent -> viewed -> accepted или declined; принять можно также из sent. withdraw и expire - дополнительные состояния. Повторные операции идемпотентны, конкурирующие переходы защищены транзакцией и текущей версией.
Приглашение содержит работодателя, описание, способ связи, обе границы зарплаты и валюту RUB. Обе границы - целые рубли, кратные 1000, 0 < salary_from < salary_to, ширина (salary_to - salary_from) / ((salary_from + salary_to) / 2) от 10% до 40% включительно (FR13 в PRD); то же правило действует для вилки потребности. Период и база налога (net или gross) показываются явно. vacancy_id необязателен. Базовые переходы: sent -> viewed -> accepted или declined; принять можно также из sent. withdraw и expire - дополнительные состояния. Повторные операции идемпотентны, конкурирующие переходы защищены транзакцией и текущей версией.
contact_grant относится к паре кандидат-компания и создается после принятого приглашения или собственного отклика кандидата. Сервер проверяет пользователя, компанию, grant и актуальную видимость при каждом чтении. До grant работодатель не получает контакты, оригинальный PDF, мессенджеры или контактные фрагменты из резюме и ML.
@@ -3,3 +3,4 @@ export { getCandidateMock } from './candidate/candidate.msw'
export { getCatalogMock } from './catalog/catalog.msw'
export { getHealthMock } from './health/health.msw'
export { getIdentityMock } from './identity/identity.msw'
export { getNeedMock } from './need/need.msw'
@@ -3,3 +3,4 @@ export * from './candidate/candidate';
export * from './catalog/catalog';
export * from './health/health';
export * from './identity/identity';
export * from './need/need';
@@ -0,0 +1,119 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
faker
} from '@faker-js/faker';
import {
HttpResponse,
http
} from 'msw';
import type {
RequestHandlerOptions
} from 'msw';
import {
CurrencyCode,
GradeCode,
NeedFieldName,
NeedItemStatus,
NeedMissingReason,
NeedMoneyStatus,
NeedReadinessStatus,
NeedRecommendationStatus,
NeedSupplyBand,
NeedValueOrigin,
NeedValueStatus,
SalaryPeriod,
SalaryTaxBasis,
SpecializationCode,
WorkFormat
} from '../../schemas';
import type {
Need,
NeedList,
NeedValueSource,
SalaryRange
} from '../../schemas';
export const getListOrganizationNeedsResponseNeedValueSourceMock = (overrideResponse: Partial<NeedValueSource> = {}): NeedValueSource => ({...{origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}, ...overrideResponse});
export const getListOrganizationNeedsResponseMock = (overrideResponse: Partial<Extract<NeedList, object>> = {}): NeedList => ({items: Array.from({ length: faker.number.int({min: 1, max: 100}) }, (_, i) => i + 1).map(() => ({id: faker.string.uuid(), vacancy_id: faker.helpers.arrayElement([faker.string.uuid(), null]), title: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), version: faker.number.int({min: 1}), specialization: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(SpecializationCode)),null,]), source: faker.helpers.arrayElement([{...getListOrganizationNeedsResponseNeedValueSourceMock()},null,])}, grade: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(GradeCode)),null,]), source: faker.helpers.arrayElement([{...getListOrganizationNeedsResponseNeedValueSourceMock()},null,])}, readiness: {status: faker.helpers.arrayElement(Object.values(NeedReadinessStatus)), missing_fields: Array.from({ length: faker.number.int({min: 1, max: 9}) }, (_, i) => i + 1).map(() => ({field: faker.helpers.arrayElement(Object.values(NeedFieldName)), reason: faker.helpers.arrayElement(Object.values(NeedMissingReason)), question: faker.string.alpha({length: {min: 1, max: 300}})}))}, created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z'})), page: {has_more: faker.datatype.boolean(), next_cursor: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), null])}, ...overrideResponse})
export const getCreateOrganizationNeedResponseNeedValueSourceMock = (overrideResponse: Partial<NeedValueSource> = {}): NeedValueSource => ({...{origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}, ...overrideResponse});
export const getCreateOrganizationNeedResponseSalaryRangeMock = (overrideResponse: Partial<SalaryRange> = {}): SalaryRange => ({...{salary_from: faker.number.int({min: 1000, max: 100000000, multipleOf: 1000}), salary_to: faker.number.int({min: 1000, max: 100000000, multipleOf: 1000}), currency: faker.helpers.arrayElement(Object.values(CurrencyCode)), period: faker.helpers.arrayElement(Object.values(SalaryPeriod)), tax_basis: faker.helpers.arrayElement(Object.values(SalaryTaxBasis))}, ...overrideResponse});
export const getCreateOrganizationNeedResponseMock = (overrideResponse: Partial<Extract<Need, object>> = {}): Need => ({id: faker.string.uuid(), organization_id: faker.string.uuid(), vacancy_id: faker.helpers.arrayElement([faker.string.uuid(), null]), title: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), source_text: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 10000}}),null,]), version: faker.number.int({min: 1}), requirements_version: faker.number.int({min: 1}), requirements: {specialization: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(SpecializationCode)),null,]), source: faker.helpers.arrayElement([{...getCreateOrganizationNeedResponseNeedValueSourceMock()},null,])}, grade: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(GradeCode)),null,]), source: faker.helpers.arrayElement([{...getCreateOrganizationNeedResponseNeedValueSourceMock()},null,])}, required_skills: Array.from({ length: faker.number.int({min: 1, max: 30}) }, (_, i) => i + 1).map(() => ({name: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), taxonomy_code: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9][a-z0-9_.+#-]*$"),null,]), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), desired_skills: Array.from({ length: faker.number.int({min: 1, max: 30}) }, (_, i) => i + 1).map(() => ({name: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), taxonomy_code: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9][a-z0-9_.+#-]*$"),null,]), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), tasks: Array.from({ length: faker.number.int({min: 1, max: 20}) }, (_, i) => i + 1).map(() => ({text: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), domain: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"),null,]), source: faker.helpers.arrayElement([{...getCreateOrganizationNeedResponseNeedValueSourceMock()},null,])}, work_formats: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElements(Object.values(WorkFormat)), null]), source: faker.helpers.arrayElement([{...getCreateOrganizationNeedResponseNeedValueSourceMock()},null,])}, location: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"),null,]), source: faker.helpers.arrayElement([{...getCreateOrganizationNeedResponseNeedValueSourceMock()},null,])}, salary: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([{...getCreateOrganizationNeedResponseSalaryRangeMock()},null,]), source: faker.helpers.arrayElement([{...getCreateOrganizationNeedResponseNeedValueSourceMock()},null,])}}, readiness: {status: faker.helpers.arrayElement(Object.values(NeedReadinessStatus)), missing_fields: Array.from({ length: faker.number.int({min: 1, max: 9}) }, (_, i) => i + 1).map(() => ({field: faker.helpers.arrayElement(Object.values(NeedFieldName)), reason: faker.helpers.arrayElement(Object.values(NeedMissingReason)), question: faker.string.alpha({length: {min: 1, max: 300}})}))}, recommendations: {status: faker.helpers.arrayElement(Object.values(NeedRecommendationStatus)), requirements_version: faker.number.int({min: 1}), policy_version: faker.helpers.arrayElement([faker.number.int({min: 1}), null]), algorithm_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,]), computed_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), categories: Array.from({ Line truncated
export const getGetOrganizationNeedResponseNeedValueSourceMock = (overrideResponse: Partial<NeedValueSource> = {}): NeedValueSource => ({...{origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}, ...overrideResponse});
export const getGetOrganizationNeedResponseSalaryRangeMock = (overrideResponse: Partial<SalaryRange> = {}): SalaryRange => ({...{salary_from: faker.number.int({min: 1000, max: 100000000, multipleOf: 1000}), salary_to: faker.number.int({min: 1000, max: 100000000, multipleOf: 1000}), currency: faker.helpers.arrayElement(Object.values(CurrencyCode)), period: faker.helpers.arrayElement(Object.values(SalaryPeriod)), tax_basis: faker.helpers.arrayElement(Object.values(SalaryTaxBasis))}, ...overrideResponse});
export const getGetOrganizationNeedResponseMock = (overrideResponse: Partial<Extract<Need, object>> = {}): Need => ({id: faker.string.uuid(), organization_id: faker.string.uuid(), vacancy_id: faker.helpers.arrayElement([faker.string.uuid(), null]), title: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), source_text: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 10000}}),null,]), version: faker.number.int({min: 1}), requirements_version: faker.number.int({min: 1}), requirements: {specialization: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(SpecializationCode)),null,]), source: faker.helpers.arrayElement([{...getGetOrganizationNeedResponseNeedValueSourceMock()},null,])}, grade: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(GradeCode)),null,]), source: faker.helpers.arrayElement([{...getGetOrganizationNeedResponseNeedValueSourceMock()},null,])}, required_skills: Array.from({ length: faker.number.int({min: 1, max: 30}) }, (_, i) => i + 1).map(() => ({name: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), taxonomy_code: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9][a-z0-9_.+#-]*$"),null,]), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), desired_skills: Array.from({ length: faker.number.int({min: 1, max: 30}) }, (_, i) => i + 1).map(() => ({name: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), taxonomy_code: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9][a-z0-9_.+#-]*$"),null,]), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), tasks: Array.from({ length: faker.number.int({min: 1, max: 20}) }, (_, i) => i + 1).map(() => ({text: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), domain: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"),null,]), source: faker.helpers.arrayElement([{...getGetOrganizationNeedResponseNeedValueSourceMock()},null,])}, work_formats: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElements(Object.values(WorkFormat)), null]), source: faker.helpers.arrayElement([{...getGetOrganizationNeedResponseNeedValueSourceMock()},null,])}, location: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"),null,]), source: faker.helpers.arrayElement([{...getGetOrganizationNeedResponseNeedValueSourceMock()},null,])}, salary: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([{...getGetOrganizationNeedResponseSalaryRangeMock()},null,]), source: faker.helpers.arrayElement([{...getGetOrganizationNeedResponseNeedValueSourceMock()},null,])}}, readiness: {status: faker.helpers.arrayElement(Object.values(NeedReadinessStatus)), missing_fields: Array.from({ length: faker.number.int({min: 1, max: 9}) }, (_, i) => i + 1).map(() => ({field: faker.helpers.arrayElement(Object.values(NeedFieldName)), reason: faker.helpers.arrayElement(Object.values(NeedMissingReason)), question: faker.string.alpha({length: {min: 1, max: 300}})}))}, recommendations: {status: faker.helpers.arrayElement(Object.values(NeedRecommendationStatus)), requirements_version: faker.number.int({min: 1}), policy_version: faker.helpers.arrayElement([faker.number.int({min: 1}), null]), algorithm_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,]), computed_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), categories: Array.from({ length: faker.number.intLine truncated
export const getUpdateOrganizationNeedResponseNeedValueSourceMock = (overrideResponse: Partial<NeedValueSource> = {}): NeedValueSource => ({...{origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}, ...overrideResponse});
export const getUpdateOrganizationNeedResponseSalaryRangeMock = (overrideResponse: Partial<SalaryRange> = {}): SalaryRange => ({...{salary_from: faker.number.int({min: 1000, max: 100000000, multipleOf: 1000}), salary_to: faker.number.int({min: 1000, max: 100000000, multipleOf: 1000}), currency: faker.helpers.arrayElement(Object.values(CurrencyCode)), period: faker.helpers.arrayElement(Object.values(SalaryPeriod)), tax_basis: faker.helpers.arrayElement(Object.values(SalaryTaxBasis))}, ...overrideResponse});
export const getUpdateOrganizationNeedResponseMock = (overrideResponse: Partial<Extract<Need, object>> = {}): Need => ({id: faker.string.uuid(), organization_id: faker.string.uuid(), vacancy_id: faker.helpers.arrayElement([faker.string.uuid(), null]), title: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), source_text: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 10000}}),null,]), version: faker.number.int({min: 1}), requirements_version: faker.number.int({min: 1}), requirements: {specialization: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(SpecializationCode)),null,]), source: faker.helpers.arrayElement([{...getUpdateOrganizationNeedResponseNeedValueSourceMock()},null,])}, grade: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(GradeCode)),null,]), source: faker.helpers.arrayElement([{...getUpdateOrganizationNeedResponseNeedValueSourceMock()},null,])}, required_skills: Array.from({ length: faker.number.int({min: 1, max: 30}) }, (_, i) => i + 1).map(() => ({name: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), taxonomy_code: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9][a-z0-9_.+#-]*$"),null,]), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), desired_skills: Array.from({ length: faker.number.int({min: 1, max: 30}) }, (_, i) => i + 1).map(() => ({name: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), taxonomy_code: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9][a-z0-9_.+#-]*$"),null,]), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), tasks: Array.from({ length: faker.number.int({min: 1, max: 20}) }, (_, i) => i + 1).map(() => ({text: faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"), status: faker.helpers.arrayElement(Object.values(NeedItemStatus)), source: {origin: faker.helpers.arrayElement(Object.values(NeedValueOrigin)), quote: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 300}}),null,]), extracted_in_version: faker.helpers.arrayElement([faker.number.int({min: 1}),null,]), extraction_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,])}})), domain: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"),null,]), source: faker.helpers.arrayElement([{...getUpdateOrganizationNeedResponseNeedValueSourceMock()},null,])}, work_formats: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.arrayElements(Object.values(WorkFormat)), null]), source: faker.helpers.arrayElement([{...getUpdateOrganizationNeedResponseNeedValueSourceMock()},null,])}, location: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([faker.helpers.fromRegExp("^\\S(?:.*\\S)?$"),null,]), source: faker.helpers.arrayElement([{...getUpdateOrganizationNeedResponseNeedValueSourceMock()},null,])}, salary: {status: faker.helpers.arrayElement(Object.values(NeedValueStatus)), value: faker.helpers.arrayElement([{...getUpdateOrganizationNeedResponseSalaryRangeMock()},null,]), source: faker.helpers.arrayElement([{...getUpdateOrganizationNeedResponseNeedValueSourceMock()},null,])}}, readiness: {status: faker.helpers.arrayElement(Object.values(NeedReadinessStatus)), missing_fields: Array.from({ length: faker.number.int({min: 1, max: 9}) }, (_, i) => i + 1).map(() => ({field: faker.helpers.arrayElement(Object.values(NeedFieldName)), reason: faker.helpers.arrayElement(Object.values(NeedMissingReason)), question: faker.string.alpha({length: {min: 1, max: 300}})}))}, recommendations: {status: faker.helpers.arrayElement(Object.values(NeedRecommendationStatus)), requirements_version: faker.number.int({min: 1}), policy_version: faker.helpers.arrayElement([faker.number.int({min: 1}), null]), algorithm_version: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"),null,]), computed_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), categories: Array.from({ Line truncated
export const getListOrganizationNeedsMockHandler = (overrideResponse?: NeedList | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<NeedList> | NeedList), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/organizations/:orgId/needs', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getListOrganizationNeedsResponseMock(),
{ status: 200
})
}, options)
}
export const getCreateOrganizationNeedMockHandler = (overrideResponse?: Need | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<Need> | Need), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/organizations/:orgId/needs', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getCreateOrganizationNeedResponseMock(),
{ status: 201
})
}, options)
}
export const getGetOrganizationNeedMockHandler = (overrideResponse?: Need | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<Need> | Need), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/organizations/:orgId/needs/:needId', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetOrganizationNeedResponseMock(),
{ status: 200
})
}, options)
}
export const getUpdateOrganizationNeedMockHandler = (overrideResponse?: Need | ((info: Parameters<Parameters<typeof http.patch>[1]>[0]) => Promise<Need> | Need), options?: RequestHandlerOptions) => {
return http.patch('*/api/v1/organizations/:orgId/needs/:needId', async (info: Parameters<Parameters<typeof http.patch>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getUpdateOrganizationNeedResponseMock(),
{ status: 200
})
}, options)
}
export const getNeedMock = () => [
getListOrganizationNeedsMockHandler(),
getCreateOrganizationNeedMockHandler(),
getGetOrganizationNeedMockHandler(),
getUpdateOrganizationNeedMockHandler()
]
@@ -0,0 +1,503 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
useMutation,
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
CreateOrganizationNeedHeaders,
ListOrganizationNeedsParams,
Need,
NeedCreate,
NeedList,
NeedUpdate,
Problem
} from '../../schemas';
import { apiRequest } from '../../client';
import type { ErrorType } from '../../client';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
const withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {
const result = { queryKey } as T & { queryKey: K };
for (const key of Object.keys(query)) {
// The explicit queryKey always wins, matching the previous
// `{ ...query, queryKey }` spread where it was set last.
if (key === 'queryKey') continue;
Object.defineProperty(result, key, {
enumerable: true,
configurable: true,
get: () => (query as Record<string, unknown>)[key],
});
}
return result;
};
export const getListOrganizationNeedsUrl = (orgId: string,
params?: ListOrganizationNeedsParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/api/v1/organizations/${orgId}/needs?${stringifiedParams}` : `/api/v1/organizations/${orgId}/needs`
}
/**
* Requires the session cookie of an employer account with an active membership in `org_id`. The organization and the role come from the membership that the server holds for the session account, never from the request. In the MVP only the owner of the organization works with needs; the other roles of the PRD FR07 matrix (recruiter, hiring manager and technical expert for assigned needs) are planned and change no field of this contract. The list holds only the needs that the role may read.
*
* Returns a page of need summaries, newest first by creation time with the identifier as the tie-breaker, with cursor pagination. A summary has the current version, the target specialization and grade with their confirmation state, and the readiness; GetOrganizationNeed returns the requirements and the recommendations.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an account without an active membership in the organization and an unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member whose role does not allow reading needs answers 403 forbidden. A malformed `org_id`, `limit`, or `cursor` answers 400 validation_failed.
* @summary List the needs of an organization.
*/
export const listOrganizationNeeds = async (orgId: string,
params?: ListOrganizationNeedsParams, options?: Parameters<typeof apiRequest>[1]): Promise<NeedList> => {
return apiRequest<NeedList>(getListOrganizationNeedsUrl(orgId,params),
{
...options,
method: 'GET'
}
);}
export const getListOrganizationNeedsQueryKey = (orgId: string,
params?: ListOrganizationNeedsParams,) => {
return [
`/api/v1/organizations/${orgId}/needs`, ...(params ? [params] : [])
] as const;
}
export const getListOrganizationNeedsQueryOptions = <TData = Awaited<ReturnType<typeof listOrganizationNeeds>>, TError = ErrorType<Problem>>(orgId: string,
params?: ListOrganizationNeedsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNeeds>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getListOrganizationNeedsQueryKey(orgId,params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof listOrganizationNeeds>>> = ({ signal }) => listOrganizationNeeds(orgId,params, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: orgId !== null && orgId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNeeds>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type ListOrganizationNeedsQueryResult = NonNullable<Awaited<ReturnType<typeof listOrganizationNeeds>>>
export type ListOrganizationNeedsQueryError = ErrorType<Problem>
export function useListOrganizationNeeds<TData = Awaited<ReturnType<typeof listOrganizationNeeds>>, TError = ErrorType<Problem>>(
orgId: string,
params: undefined | ListOrganizationNeedsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNeeds>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof listOrganizationNeeds>>,
TError,
Awaited<ReturnType<typeof listOrganizationNeeds>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListOrganizationNeeds<TData = Awaited<ReturnType<typeof listOrganizationNeeds>>, TError = ErrorType<Problem>>(
orgId: string,
params?: ListOrganizationNeedsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNeeds>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof listOrganizationNeeds>>,
TError,
Awaited<ReturnType<typeof listOrganizationNeeds>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListOrganizationNeeds<TData = Awaited<ReturnType<typeof listOrganizationNeeds>>, TError = ErrorType<Problem>>(
orgId: string,
params?: ListOrganizationNeedsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNeeds>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary List the needs of an organization.
*/
export function useListOrganizationNeeds<TData = Awaited<ReturnType<typeof listOrganizationNeeds>>, TError = ErrorType<Problem>>(
orgId: string,
params?: ListOrganizationNeedsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNeeds>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getListOrganizationNeedsQueryOptions(orgId,params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getCreateOrganizationNeedUrl = (orgId: string,) => {
return `/api/v1/organizations/${orgId}/needs`
}
/**
* Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The organization comes from the path and the server-side membership; the body has no organization, membership, or role field. In the MVP only the owner of the organization may create a need; the other roles of PRD FR07 are planned.
*
* A need does not require a vacancy: `vacancy_id` is optional and nullable. When it is given, it must name a vacancy of the same organization; until vacancies exist in the contract, any vacancy identifier answers 400 with the pointer `/vacancy_id`, the same for an unknown vacancy and one of another organization.
*
* Only `title` is required. A field is sent as a decision `{value, status}` and a list item as `{name or text, status}`; on creation the status must be `confirmed`, and the value becomes a confirmed manual value. When `source_text` is given, the server extracts suggestions for the absent fields with deterministic rules and a dictionary before it answers, so creation works while the ML service is disabled; every suggestion has the status `extracted`, the origin extracted_from_text, a quote where the extractor found one, and the extractor version, and it waits for a member to confirm it. A field that the text does not state stays `unknown` with null value and source; the server never guesses a grade, a format, or a salary. ML suggestions with quotes are planned as an asynchronous addition that creates a new version and never overwrites a confirmed value.
*
* The need is saved even when critical fields are missing: the response is 201 with version 1, and `readiness.missing_fields` names each critical field without a confirmed value with a specific question. `recommendations` is computed by the server from the confirmed requirements only; the request cannot set a recommendation, its score, or its components. Creating a need never contacts a candidate or sends an invitation.
*
* Salary limit: setting a salary range counts against a limit shared by the whole organization, every member and every need, on creation as on a change: at most three range settings a day (PRD FR13, planned in TASK-211). Over the limit the server answers 429 with Retry-After and creates nothing. After five settings within seven days the money component of the recommendations is `withheld` for seven days. The limit keeps an organization from probing hidden candidate minimums with new needs instead of edits; repeated range changes also feed the private risk signals of TASK-319.
*
* Idempotency: a retry with the same key and body within 24 hours replays the stored 201 and creates nothing, so a lost response never creates a second need. A different body with the same key answers 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again.
*
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a pointer: `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose width is outside 10-40%, `/required_skills/1/name` for a repeated skill, `/grade/status` or `/required_skills/0/status` for `extracted`, which a new need cannot have, or `/vacancy_id`), then the salary limit (429). The schema already rejects unknown fields such as `rec_score`, `members`, or `candidate_minimum`, a field sent as a bare value instead of `{value, status}`, a salary bound that is not a positive multiple of 1000, and an unknown currency, period, or tax basis. The general rate limit can answer 429 with Retry-After before any check. 429 is never stored.
* @summary Create a need of an organization from a form, a text, or both.
*/
export const createOrganizationNeed = async (orgId: string,
needCreate: NeedCreate,
headers: CreateOrganizationNeedHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<Need> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<Need>(getCreateOrganizationNeedUrl(orgId),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
body: JSON.stringify(needCreate)
}
);}
export const getCreateOrganizationNeedMutationKey = () => ['createOrganizationNeed'] as const;
export const getCreateOrganizationNeedMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganizationNeed>>, TError,CreateOrganizationNeedMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof createOrganizationNeed>>, TError,CreateOrganizationNeedMutationVariables, TContext> => {
const mutationKey = getCreateOrganizationNeedMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganizationNeed>>, CreateOrganizationNeedMutationVariables> = (props) => {
const {orgId,data,headers} = props ?? {};
return createOrganizationNeed(orgId,data,headers,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type CreateOrganizationNeedMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganizationNeed>>>
export type CreateOrganizationNeedMutationBody = NeedCreate
export type CreateOrganizationNeedMutationError = ErrorType<Problem>
export type CreateOrganizationNeedMutationVariables = {orgId: string;data: NeedCreate;headers: CreateOrganizationNeedHeaders}
/**
* @summary Create a need of an organization from a form, a text, or both.
*/
export const useCreateOrganizationNeed = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganizationNeed>>, TError,CreateOrganizationNeedMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof createOrganizationNeed>>,
TError,
CreateOrganizationNeedMutationVariables,
TContext
> => {
return useMutation(getCreateOrganizationNeedMutationOptions(options), queryClient);
}
export const getGetOrganizationNeedUrl = (orgId: string,
needId: string,) => {
return `/api/v1/organizations/${orgId}/needs/${needId}`
}
/**
* Requires the session cookie of an employer account with an active membership in `org_id`. The organization and the role come from the server-side membership, never from the request. In the MVP only the owner of the organization reads needs; the other roles of PRD FR07 are planned.
*
* Returns the current version of the need: `version`, the requirements with the confirmation state and provenance of each field (`status`, and `source` with the origin, the quote, the version whose text the quote belongs to, and the extractor version), the readiness with `missing_fields`, and the category recommendations of the server. A field with status `unknown` has null value and source; an `extracted` value is a suggestion that waits for confirmation and never feeds search or recommendations.
*
* Versions: every committed change creates a new immutable `version`, and this operation always returns the latest one. `requirements_version` is the version in which the confirmed requirements were last changed; a change of the title, the vacancy link, the text, or suggestions only keeps it. Search runs, selection snapshots, and invitations refer to a need by its identifier and `requirements_version`, so they keep the requirements they used, and only a new `requirements_version` calls for a new selection snapshot. Reading and comparing earlier versions (PRD FR10) are planned as separate operations that return the same NeedRequirementSet for a given version; they add no field here.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an account without an active membership in the organization, an unknown organization, an unknown need, and a need of another organization all answer 404 not_found, so identifiers cannot be probed; a member whose role does not allow reading the need answers 403 forbidden. An `org_id` or `need_id` that is not a UUID answers 400 validation_failed with the path pointer.
* @summary Read the current version of a need of an organization.
*/
export const getOrganizationNeed = async (orgId: string,
needId: string, options?: Parameters<typeof apiRequest>[1]): Promise<Need> => {
return apiRequest<Need>(getGetOrganizationNeedUrl(orgId,needId),
{
...options,
method: 'GET'
}
);}
export const getGetOrganizationNeedQueryKey = (orgId: string,
needId: string,) => {
return [
`/api/v1/organizations/${orgId}/needs/${needId}`
] as const;
}
export const getGetOrganizationNeedQueryOptions = <TData = Awaited<ReturnType<typeof getOrganizationNeed>>, TError = ErrorType<Problem>>(orgId: string,
needId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganizationNeed>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetOrganizationNeedQueryKey(orgId,needId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganizationNeed>>> = ({ signal }) => getOrganizationNeed(orgId,needId, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: orgId !== null && orgId !== undefined && needId !== null && needId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganizationNeed>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetOrganizationNeedQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganizationNeed>>>
export type GetOrganizationNeedQueryError = ErrorType<Problem>
export function useGetOrganizationNeed<TData = Awaited<ReturnType<typeof getOrganizationNeed>>, TError = ErrorType<Problem>>(
orgId: string,
needId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganizationNeed>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getOrganizationNeed>>,
TError,
Awaited<ReturnType<typeof getOrganizationNeed>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetOrganizationNeed<TData = Awaited<ReturnType<typeof getOrganizationNeed>>, TError = ErrorType<Problem>>(
orgId: string,
needId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganizationNeed>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getOrganizationNeed>>,
TError,
Awaited<ReturnType<typeof getOrganizationNeed>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetOrganizationNeed<TData = Awaited<ReturnType<typeof getOrganizationNeed>>, TError = ErrorType<Problem>>(
orgId: string,
needId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganizationNeed>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read the current version of a need of an organization.
*/
export function useGetOrganizationNeed<TData = Awaited<ReturnType<typeof getOrganizationNeed>>, TError = ErrorType<Problem>>(
orgId: string,
needId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganizationNeed>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetOrganizationNeedQueryOptions(orgId,needId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getUpdateOrganizationNeedUrl = (orgId: string,
needId: string,) => {
return `/api/v1/organizations/${orgId}/needs/${needId}`
}
/**
* Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization and the role come from the server-side membership; the body has no organization, membership, or role field. In the MVP only the owner of the organization changes needs; the technical expert, who may refine the requirements of assigned needs under PRD FR07, is planned.
*
* Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch. Each field present replaces that field as a whole and an absent field stays unchanged; a field decision and each list are replaced entirely and never merged. This keeps every field one optional value in the generated server and client, without nested partial updates.
*
* Each requirement field is sent as a decision `{value, status}` and each list item as `{name or text, status}`, so confirmation is always explicit:
* - Confirm a suggestion: send its stored value with `confirmed`. It keeps its origin and quote.
* - Keep a suggestion open: send its stored value with `extracted`, or leave the field out. `extracted` with any other value, or for a field or item without a stored suggestion, answers 400 with the pointer of that `status`, for example `/grade/status` or `/required_skills/2/status`. A client that sends back an unchanged form therefore never confirms a suggestion by accident.
* - Change: send another value with `confirmed`. It becomes a confirmed manual value, and its quote is dropped.
* - Delete: send null for a nullable field, which makes it `unknown` (or unlinks `vacancy_id`), or leave the item out of a skill or task list, which deletes it. An empty skill or task list deletes every item; a list sent as null answers 400. A deleted requirement really changes the requirements that search uses, not only an explanation, and a deleted suggestion is not proposed again by a later extraction.
* - Text: a different `source_text` extracts again. New suggestions replace only the `extracted` values and items of the fields not named in the body; confirmed values are never overwritten, and a suggested skill whose name is already in either skill list is skipped. Null removes the text and keeps every value.
*
* Versions: every committed change creates version `expected_version + 1` as an immutable snapshot and answers 200 with it. `requirements_version` becomes the new version only when a confirmed requirement was confirmed, changed, or removed. `expected_version` is the `version` the client read; when it is not current, the server answers 412 version_conflict and changes nothing, and the client reads the need again and reapplies its unsaved edits. The version travels in the body rather than in If-Match because the generated client cannot read the ETag response header yet, as for the questionnaire. Concurrent changes therefore never overwrite each other silently.
*
* The operation needs no Idempotency-Key: a body that changes nothing when applied to the current version, such as a retry of a change that already succeeded, keeps the version and answers 200 with the current need even when `expected_version` is older. An incomplete need is a valid result; `readiness.missing_fields` tells what remains.
*
* Salary limit: the recommendations aggregate candidates' minimums against the upper bound, so setting or changing a confirmed salary range counts against a limit shared by the whole organization, every member and every need, together with ranges set on creation: at most three a day (PRD FR13, planned in TASK-211). Over the limit the server answers 429 with Retry-After and changes nothing. After five settings within seven days the money component is `withheld` for seven days. Repeated range changes also feed the private risk signals of TASK-319.
*
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403 forbidden), the need (404 not_found), a body that changes nothing (200), the version (412), domain rules (400 with a pointer such as `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose width is outside 10-40%, `/desired_skills/0/name` for a skill that is also in the required list, `/grade/status` or `/required_skills/2/status` for `extracted` with a value that is not the stored suggestion, or `/vacancy_id`), then the salary change limit (429). The schema rejects a missing or non-positive `expected_version`, unknown fields such as `rec_score`, `members`, `candidate_minimum`, or `version`, a field sent as a bare value instead of `{value, status}`, a list sent as null, a salary bound that is not a positive multiple of 1000, and an unknown currency, period, or tax basis.
* @summary Confirm, change, or delete requirements of a need.
*/
export const updateOrganizationNeed = async (orgId: string,
needId: string,
needUpdate: NeedUpdate, options?: Parameters<typeof apiRequest>[1]): Promise<Need> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<Need>(getUpdateOrganizationNeedUrl(orgId,needId),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
body: JSON.stringify(needUpdate)
}
);}
export const getUpdateOrganizationNeedMutationKey = () => ['updateOrganizationNeed'] as const;
export const getUpdateOrganizationNeedMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateOrganizationNeed>>, TError,UpdateOrganizationNeedMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof updateOrganizationNeed>>, TError,UpdateOrganizationNeedMutationVariables, TContext> => {
const mutationKey = getUpdateOrganizationNeedMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateOrganizationNeed>>, UpdateOrganizationNeedMutationVariables> = (props) => {
const {orgId,needId,data} = props ?? {};
return updateOrganizationNeed(orgId,needId,data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type UpdateOrganizationNeedMutationResult = NonNullable<Awaited<ReturnType<typeof updateOrganizationNeed>>>
export type UpdateOrganizationNeedMutationBody = NeedUpdate
export type UpdateOrganizationNeedMutationError = ErrorType<Problem>
export type UpdateOrganizationNeedMutationVariables = {orgId: string;needId: string;data: NeedUpdate}
/**
* @summary Confirm, change, or delete requirements of a need.
*/
export const useUpdateOrganizationNeed = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateOrganizationNeed>>, TError,UpdateOrganizationNeedMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof updateOrganizationNeed>>,
TError,
UpdateOrganizationNeedMutationVariables,
TContext
> => {
return useMutation(getUpdateOrganizationNeedMutationOptions(options), queryClient);
}
@@ -0,0 +1,343 @@
import { describe, expect, expectTypeOf, it } from "vitest";
import { createOrganizationNeed, updateOrganizationNeed } from "./endpoints/need/need";
import {
CreateOrganizationNeedBody,
Need,
NeedCategoryRecommendation,
NeedCreate,
NeedUpdate,
SalaryRange,
UpdateOrganizationNeedBody,
} from "./schemas";
// These tests pin the generated need contract that the FSD adapters consume.
// They fail when regeneration drops a salary limit, an unknown state, or the
// explicit confirmation status of a field, or adds a request field that would
// let an employer set membership, a candidate's minimum, or a ready
// recommendation score.
const salary = {
salary_from: 120000,
salary_to: 160000,
currency: "RUB",
period: "month",
tax_basis: "net",
} as const;
const manualNeed = {
title: "Junior Go-разработчик для сервиса уведомлений",
specialization: { value: "backend", status: "confirmed" },
grade: { value: "junior", status: "confirmed" },
required_skills: [
{ name: "Go", status: "confirmed" },
{ name: "PostgreSQL", status: "confirmed" },
],
desired_skills: [{ name: "Docker", status: "confirmed" }],
tasks: [{ text: "Поддерживать и развивать сервис уведомлений", status: "confirmed" }],
work_formats: { value: ["hybrid"], status: "confirmed" },
location: { value: "Москва", status: "confirmed" },
salary: { value: salary, status: "confirmed" },
} as const;
const createSchemas = [
["NeedCreate", NeedCreate],
["CreateOrganizationNeedBody", CreateOrganizationNeedBody],
] as const;
describe.each(createSchemas)("generated %s", (_name, schema) => {
it("accepts a manual need without a vacancy", () => {
const parsed = schema.parse(manualNeed);
expect(parsed).not.toHaveProperty("vacancy_id");
expect(parsed.salary).toEqual({ value: salary, status: "confirmed" });
});
it("accepts a need from a title and a text only", () => {
const parsed = schema.parse({ title: "Backend", source_text: "Ищем бэкенд-разработчика." });
expect(parsed).toEqual({ title: "Backend", source_text: "Ищем бэкенд-разработчика." });
});
it("keeps an explicit null as a field without a value", () => {
const parsed = schema.parse({ title: "Backend", vacancy_id: null, grade: null, salary: null });
expect(parsed).toEqual({ title: "Backend", vacancy_id: null, grade: null, salary: null });
});
it("requires a title", () => {
const result = schema.safeParse({ specialization: { value: "backend", status: "confirmed" } });
expect(result.success).toBe(false);
expect(result.error?.issues).toEqual([expect.objectContaining({ path: ["title"] })]);
});
it.each([
["a bare value", "junior"],
["a value without a status", { value: "junior" }],
["an unknown status", { value: "junior", status: "unknown" }],
["a grade outside the scale", { value: "lead", status: "confirmed" }],
])("rejects a grade decision with %s", (_case, grade) => {
const result = schema.safeParse({ ...manualNeed, grade });
expect(result.success).toBe(false);
expect(result.error?.issues).toEqual([
expect.objectContaining({ path: expect.arrayContaining(["grade"]) }),
]);
});
it.each([
["a zero lower bound", { salary_from: 0 }, "salary_from"],
["a negative lower bound", { salary_from: -1000 }, "salary_from"],
["a bound that is not a multiple of 1000", { salary_to: 160500 }, "salary_to"],
["a fractional bound", { salary_to: 160000.5 }, "salary_to"],
["another currency", { currency: "USD" }, "currency"],
["an hourly period", { period: "hour" }, "period"],
["an unknown tax basis", { tax_basis: "after_tax" }, "tax_basis"],
])("rejects a salary with %s", (_case, change, field) => {
const range = { ...salary, ...change };
const result = schema.safeParse({
...manualNeed,
salary: { value: range, status: "confirmed" },
});
// The nullable salary is a union, so Zod reports some failures on the
// union and others on the field; the range schema itself names the field.
expect(result.success).toBe(false);
expect(result.error?.issues).toEqual([
expect.objectContaining({ path: expect.arrayContaining(["salary"]) }),
]);
expect(SalaryRange.safeParse(range).error?.issues).toEqual([
expect.objectContaining({ path: [field] }),
]);
});
it("rejects a salary without a tax basis or without a decision", () => {
const withoutBasis = {
salary_from: salary.salary_from,
salary_to: salary.salary_to,
currency: salary.currency,
period: salary.period,
};
expect(
schema.safeParse({ ...manualNeed, salary: { value: withoutBasis, status: "confirmed" } })
.success,
).toBe(false);
expect(schema.safeParse({ ...manualNeed, salary }).success).toBe(false);
});
it("leaves the cross-field salary rules to the server", () => {
// A < B and the 10-40% width compare two fields; the server answers 400
// with the pointer /salary/value/salary_to.
for (const [from, to] of [
[150000, 150000],
[100000, 200000],
]) {
const range = { ...salary, salary_from: from, salary_to: to };
expect(SalaryRange.safeParse(range).success).toBe(true);
}
});
it("rejects an unknown item status and empty work formats", () => {
expect(
schema.safeParse({ ...manualNeed, required_skills: [{ name: "Go", status: "unknown" }] })
.success,
).toBe(false);
expect(
schema.safeParse({ ...manualNeed, work_formats: { value: [], status: "confirmed" } }).success,
).toBe(false);
});
it("never carries membership, a candidate minimum, or a score in the parsed body", () => {
const parsed = schema.parse({
...manualNeed,
rec_score: 0.99,
members: [{ user_id: "01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01", role: "owner" }],
candidate_minimum: 130000,
salary: { value: { ...salary, candidate_minimum: 130000 }, status: "confirmed" },
});
// Generated Zod strips unknown keys; the server rejects them with 400.
expect(parsed).not.toHaveProperty("rec_score");
expect(parsed).not.toHaveProperty("members");
expect(parsed).not.toHaveProperty("candidate_minimum");
expect(parsed.salary?.value).not.toHaveProperty("candidate_minimum");
});
});
const updateSchemas = [
["NeedUpdate", NeedUpdate],
["UpdateOrganizationNeedBody", UpdateOrganizationNeedBody],
] as const;
describe.each(updateSchemas)("generated %s", (_name, schema) => {
it("confirms suggestions and keeps others open explicitly", () => {
const parsed = schema.parse({
expected_version: 1,
specialization: { value: "backend", status: "confirmed" },
grade: { value: "middle", status: "confirmed" },
domain: { value: "платежи", status: "extracted" },
required_skills: [{ name: "Temporal", status: "confirmed" }],
desired_skills: [{ name: "Kafka", status: "extracted" }],
salary: { value: { ...salary, tax_basis: "gross" }, status: "confirmed" },
});
expect(parsed.domain).toEqual({ value: "платежи", status: "extracted" });
expect(parsed.desired_skills).toEqual([{ name: "Kafka", status: "extracted" }]);
});
it("keeps null, which removes a requirement, apart from an absent field", () => {
const parsed = schema.parse({ expected_version: 3, grade: null, salary: null, tasks: [] });
expect(parsed).toEqual({ expected_version: 3, grade: null, salary: null, tasks: [] });
expect(parsed).not.toHaveProperty("specialization");
});
it("rejects a list sent as null", () => {
expect(schema.safeParse({ expected_version: 3, tasks: null }).success).toBe(false);
});
it.each([
["missing", {}],
["zero", { expected_version: 0 }],
["fractional", { expected_version: 1.5 }],
["text", { expected_version: "1" }],
])("rejects an expected_version that is %s", (_case, version) => {
const result = schema.safeParse({ ...version, grade: null });
expect(result.success).toBe(false);
expect(result.error?.issues).toEqual([expect.objectContaining({ path: ["expected_version"] })]);
});
});
it("parses a need whose unknown fields stay null instead of guessed values", () => {
const unknown = { status: "unknown", value: null, source: null } as const;
const parsed = Need.parse({
id: "01928f7a-3c4d-7e5f-8a6b-7c8d9e0f1a23",
organization_id: "01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01",
vacancy_id: null,
title: "Backend в команду платежей",
source_text: "Ищем бэкенд-разработчика. Обязательно: Go и Temporal.",
version: 1,
requirements_version: 1,
requirements: {
specialization: {
status: "extracted",
value: "backend",
source: {
origin: "extracted_from_text",
quote: "Ищем бэкенд-разработчика",
extracted_in_version: 1,
extraction_version: "need-rules.2026-10.1",
},
},
grade: unknown,
required_skills: [
{
name: "Temporal",
taxonomy_code: null,
status: "extracted",
source: {
origin: "extracted_from_text",
quote: "Обязательно: Go и Temporal",
extracted_in_version: 1,
extraction_version: "need-rules.2026-10.1",
},
},
],
desired_skills: [],
tasks: [],
domain: unknown,
work_formats: unknown,
location: unknown,
salary: unknown,
},
readiness: {
status: "incomplete",
missing_fields: [
{
field: "grade",
reason: "unknown",
question: "Какой грейд нужен: Intern, Junior, Middle или Senior?",
},
],
},
recommendations: {
status: "not_available",
requirements_version: 1,
policy_version: null,
algorithm_version: null,
computed_at: null,
categories: [],
},
created_at: "2026-10-06T09:00:00Z",
updated_at: "2026-10-06T09:00:00Z",
});
expect(parsed.requirements.grade).toEqual(unknown);
expect(parsed.requirements.salary.value).toBeNull();
expect(parsed.requirements.required_skills[0]?.taxonomy_code).toBeNull();
expect(parsed.requirements.required_skills[0]?.source.extracted_in_version).toBe(1);
});
it("parses a recommendation whose small group hides the score", () => {
const parsed = NeedCategoryRecommendation.parse({
specialization: "backend",
grade: "intern",
score: null,
skill_overlap: { share: 0.8, covered_skills: ["Go"], uncovered_skills: ["Docker"] },
money: { status: "withheld", share: null },
supply: "fewer_than_5",
});
expect(parsed.score).toBeNull();
expect(
NeedCategoryRecommendation.safeParse({ ...parsed, money: { status: "hidden", share: null } })
.success,
).toBe(false);
});
type ForbiddenRequestKey =
| "rec_score"
| "score"
| "recommendations"
| "candidate_minimum"
| "salary_minimum"
| "minimum"
| "members"
| "membership"
| "role"
| "organization_id"
| "version"
| "requirements_version"
| "readiness"
| "source"
| "origin"
| "quote";
type ItemOf<T> = T extends readonly (infer Item)[] ? Item : never;
it("exposes request DTOs without membership, candidate minimum, or recommendation fields", () => {
expectTypeOf<Extract<keyof NeedCreate, ForbiddenRequestKey>>().toEqualTypeOf<never>();
expectTypeOf<Extract<keyof NeedUpdate, ForbiddenRequestKey>>().toEqualTypeOf<never>();
expectTypeOf<
Extract<keyof NonNullable<NeedCreate["salary"]>, ForbiddenRequestKey>
>().toEqualTypeOf<never>();
expectTypeOf<
Extract<keyof NonNullable<NeedUpdate["salary"]>["value"], ForbiddenRequestKey>
>().toEqualTypeOf<never>();
expectTypeOf<
Extract<keyof NonNullable<NeedUpdate["grade"]>, ForbiddenRequestKey>
>().toEqualTypeOf<never>();
expectTypeOf<
Extract<keyof ItemOf<NonNullable<NeedUpdate["required_skills"]>>, ForbiddenRequestKey>
>().toEqualTypeOf<never>();
// A field decision always carries an explicit status, so a round-tripped
// form cannot confirm a suggestion without saying so.
expectTypeOf<NonNullable<NeedUpdate["grade"]>["status"]>().toEqualTypeOf<
"confirmed" | "extracted"
>();
expectTypeOf(createOrganizationNeed).parameter(1).toEqualTypeOf<NeedCreate>();
expectTypeOf(updateOrganizationNeed).parameter(2).toEqualTypeOf<NeedUpdate>();
});
@@ -13,4 +13,3 @@ export * from './questionnaireVersion.zod';
export * from './saveMyQuestionnaireBody.zod';
export * from './stackTag.zod';
export * from './workContext.zod';
export * from './workFormat.zod';
+2 -1
View File
@@ -6,7 +6,6 @@
*/
export * from './gradeCode.zod';
export * from './pageInfo.zod';
export * from './problem.zod';
export * from './problemCode.zod';
export * from './problemFieldError.zod';
@@ -14,8 +13,10 @@ export * from './problemFieldLocation.zod';
export * from './specializationCode.zod';
export * from './taskLanguage.zod';
export * from './timestamp.zod';
export * from './workFormat.zod';
export * from './assessment';
export * from './candidate';
export * from './catalog';
export * from './health';
export * from './identity';
export * from './need';
@@ -0,0 +1,101 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const createOrganizationNeedBodyTitleMax = 200;
export const createOrganizationNeedBodyTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationNeedBodySourceTextOneMax = 10000;
export const createOrganizationNeedBodyRequiredSkillsItemNameMax = 100;
export const createOrganizationNeedBodyRequiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationNeedBodyRequiredSkillsMax = 30;
export const createOrganizationNeedBodyDesiredSkillsItemNameMax = 100;
export const createOrganizationNeedBodyDesiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationNeedBodyDesiredSkillsMax = 30;
export const createOrganizationNeedBodyTasksItemTextMax = 300;
export const createOrganizationNeedBodyTasksItemTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationNeedBodyTasksMax = 20;
export const createOrganizationNeedBodyDomainOneValueMax = 100;
export const createOrganizationNeedBodyDomainOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationNeedBodyWorkFormatsOneValueMax = 3;
export const createOrganizationNeedBodyLocationOneValueMax = 100;
export const createOrganizationNeedBodyLocationOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationNeedBodySalaryOneValueSalaryFromMin = 1000;
export const createOrganizationNeedBodySalaryOneValueSalaryFromMax = 100000000;
export const createOrganizationNeedBodySalaryOneValueSalaryFromMultipleOf = 1000;
export const createOrganizationNeedBodySalaryOneValueSalaryToMin = 1000;
export const createOrganizationNeedBodySalaryOneValueSalaryToMax = 100000000;
export const createOrganizationNeedBodySalaryOneValueSalaryToMultipleOf = 1000;
export const CreateOrganizationNeedBody = zod.object({
"title": zod.string().min(1).max(createOrganizationNeedBodyTitleMax).regex(createOrganizationNeedBodyTitleRegExp).describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"vacancy_id": zod.uuid().nullish().describe('Vacancy of the same organization to link, or null or absent for a need without a vacancy.'),
"source_text": zod.union([zod.string().min(1).max(createOrganizationNeedBodySourceTextOneMax).describe('Free description of the team\'s tasks as the employer wrote or pasted it. The server extracts proposed requirements from it; the text itself is never a requirement. It may contain line breaks. Plain text; clients show it as text, never as HTML. It describes the job and must not contain personal data of candidates. The server stores it as written: it may contain requirements that discriminate by a protected characteristic, and the extractor never turns such a requirement into a need field. Exclusions, the requirements that a candidate must not meet, are planned as a separate additive field with the Labor Code article 64 check (TASK-182).'),zod.null()]).exactOptional(),
"specialization": zod.union([zod.object({
"value": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the specialization in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"grade": zod.union([zod.object({
"value": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the grade in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"required_skills": zod.array(zod.object({
"name": zod.string().min(1).max(createOrganizationNeedBodyRequiredSkillsItemNameMax).regex(createOrganizationNeedBodyRequiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(createOrganizationNeedBodyRequiredSkillsMax).exactOptional(),
"desired_skills": zod.array(zod.object({
"name": zod.string().min(1).max(createOrganizationNeedBodyDesiredSkillsItemNameMax).regex(createOrganizationNeedBodyDesiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(createOrganizationNeedBodyDesiredSkillsMax).exactOptional(),
"tasks": zod.array(zod.object({
"text": zod.string().min(1).max(createOrganizationNeedBodyTasksItemTextMax).regex(createOrganizationNeedBodyTasksItemTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One task of the list in a request. A text equal to a task of the current version refers to that task and keeps its origin and quote; any other text is a new manual task. `status` and repeated texts follow the rules of NeedSkillInput.')).max(createOrganizationNeedBodyTasksMax).exactOptional(),
"domain": zod.union([zod.object({
"value": zod.string().min(1).max(createOrganizationNeedBodyDomainOneValueMax).regex(createOrganizationNeedBodyDomainOneValueRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the domain in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"work_formats": zod.union([zod.object({
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(createOrganizationNeedBodyWorkFormatsOneValueMax),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the work formats in a request; see NeedUpdate for the rules of `status`. Formats are compared as a set.'),zod.null()]).exactOptional(),
"location": zod.union([zod.object({
"value": zod.string().min(1).max(createOrganizationNeedBodyLocationOneValueMax).regex(createOrganizationNeedBodyLocationOneValueRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the place of work in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"salary": zod.union([zod.object({
"value": zod.object({
"salary_from": zod.int().min(createOrganizationNeedBodySalaryOneValueSalaryFromMin).max(createOrganizationNeedBodySalaryOneValueSalaryFromMax).multipleOf(createOrganizationNeedBodySalaryOneValueSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(createOrganizationNeedBodySalaryOneValueSalaryToMin).max(createOrganizationNeedBodySalaryOneValueSalaryToMax).multipleOf(createOrganizationNeedBodySalaryOneValueSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the salary range in a request; see NeedUpdate for the rules of `status` and SalaryRange for the rules of the range, whose pointers are under `/salary/value`.'),zod.null()]).exactOptional()
}).describe('New need. Only `title` is required, so a need can start from a title, from a text, or from form fields, and with or without a vacancy. A field or list item given here must have `status` `confirmed` and becomes a confirmed manual value; `extracted` answers 400 with the pointer of that `status`, such as `/grade/status`, because a new need has no stored suggestion. A field that is absent is extracted from `source_text` when the text is given and is left unknown or empty otherwise. A nullable field sent as null, and a skill or task list sent as an empty list, stays unknown or empty and is not extracted; an empty `work_formats` value fails `minItems`. Unknown fields are rejected, so a request cannot set membership, a role, a status of the need, a provenance, readiness, a recommendation or its score, or a candidate\'s salary minimum.')
export type CreateOrganizationNeedBody = zod.input<typeof CreateOrganizationNeedBody>;
export type CreateOrganizationNeedBodyOutput = zod.output<typeof CreateOrganizationNeedBody>;
@@ -0,0 +1,19 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const createOrganizationNeedHeadersIdempotencyKeyMax = 255;
export const createOrganizationNeedHeadersIdempotencyKeyRegExp = new RegExp('^[A-Za-z0-9._:-]+$');
export const CreateOrganizationNeedHeaders = zod.object({
"Idempotency-Key": zod.string().min(1).max(createOrganizationNeedHeadersIdempotencyKeyMax).regex(createOrganizationNeedHeadersIdempotencyKeyRegExp)
})
export type CreateOrganizationNeedHeaders = zod.input<typeof CreateOrganizationNeedHeaders>;
export type CreateOrganizationNeedHeadersOutput = zod.output<typeof CreateOrganizationNeedHeaders>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const CurrencyCode = zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.')
export type CurrencyCode = zod.input<typeof CurrencyCode>;
export type CurrencyCodeOutput = zod.output<typeof CurrencyCode>;
@@ -0,0 +1,65 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
export * from './createOrganizationNeedBody.zod';
export * from './createOrganizationNeedHeaders.zod';
export * from './currencyCode.zod';
export * from './listOrganizationNeedsParams.zod';
export * from './need.zod';
export * from './needCategoryRecommendation.zod';
export * from './needCategoryRecommendations.zod';
export * from './needCreate.zod';
export * from './needDomain.zod';
export * from './needDomainInput.zod';
export * from './needDomainName.zod';
export * from './needFieldName.zod';
export * from './needGrade.zod';
export * from './needGradeInput.zod';
export * from './needItemStatus.zod';
export * from './needList.zod';
export * from './needLocation.zod';
export * from './needLocationInput.zod';
export * from './needLocationName.zod';
export * from './needMissingField.zod';
export * from './needMissingReason.zod';
export * from './needMoneyFit.zod';
export * from './needMoneyStatus.zod';
export * from './needReadinessReport.zod';
export * from './needReadinessStatus.zod';
export * from './needRecommendationStatus.zod';
export * from './needRequirementSet.zod';
export * from './needSalary.zod';
export * from './needSalaryInput.zod';
export * from './needSkill.zod';
export * from './needSkillInput.zod';
export * from './needSkillOverlap.zod';
export * from './needSourceQuote.zod';
export * from './needSourceText.zod';
export * from './needSpecialization.zod';
export * from './needSpecializationInput.zod';
export * from './needSummary.zod';
export * from './needSupplyBand.zod';
export * from './needTask.zod';
export * from './needTaskInput.zod';
export * from './needTaskText.zod';
export * from './needTitle.zod';
export * from './needUpdate.zod';
export * from './needValueOrigin.zod';
export * from './needValueSource.zod';
export * from './needValueStatus.zod';
export * from './needVersion.zod';
export * from './needVersionLabel.zod';
export * from './needWorkFormats.zod';
export * from './needWorkFormatsInput.zod';
export * from './pageInfo.zod';
export * from './rubAmount.zod';
export * from './salaryPeriod.zod';
export * from './salaryRange.zod';
export * from './salaryTaxBasis.zod';
export * from './skillName.zod';
export * from './skillTaxonomyCode.zod';
export * from './updateOrganizationNeedBody.zod';
@@ -0,0 +1,23 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const listOrganizationNeedsParamsLimitDefault = 20;
export const listOrganizationNeedsParamsLimitMax = 100;
export const listOrganizationNeedsParamsCursorMax = 512;
export const listOrganizationNeedsParamsCursorRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const ListOrganizationNeedsParams = zod.object({
"limit": zod.int().min(1).max(listOrganizationNeedsParamsLimitMax).default(listOrganizationNeedsParamsLimitDefault),
"cursor": zod.string().min(1).max(listOrganizationNeedsParamsCursorMax).regex(listOrganizationNeedsParamsCursorRegExp).exactOptional()
})
export type ListOrganizationNeedsParams = zod.input<typeof ListOrganizationNeedsParams>;
export type ListOrganizationNeedsParamsOutput = zod.output<typeof ListOrganizationNeedsParams>;
@@ -0,0 +1,301 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needTitleMax = 200;
export const needTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needSourceTextOneMax = 10000;
export const needRequirementsSpecializationSourceOneQuoteOneMax = 300;
export const needRequirementsSpecializationSourceOneExtractionVersionOneMax = 64;
export const needRequirementsSpecializationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsGradeSourceOneQuoteOneMax = 300;
export const needRequirementsGradeSourceOneExtractionVersionOneMax = 64;
export const needRequirementsGradeSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsRequiredSkillsItemNameMax = 100;
export const needRequirementsRequiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementsRequiredSkillsItemTaxonomyCodeOneMax = 64;
export const needRequirementsRequiredSkillsItemTaxonomyCodeOneRegExp = new RegExp('^[a-z0-9][a-z0-9_.+#-]*$');
export const needRequirementsRequiredSkillsItemSourceQuoteOneMax = 300;
export const needRequirementsRequiredSkillsItemSourceExtractionVersionOneMax = 64;
export const needRequirementsRequiredSkillsItemSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsRequiredSkillsMax = 30;
export const needRequirementsDesiredSkillsItemNameMax = 100;
export const needRequirementsDesiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementsDesiredSkillsItemTaxonomyCodeOneMax = 64;
export const needRequirementsDesiredSkillsItemTaxonomyCodeOneRegExp = new RegExp('^[a-z0-9][a-z0-9_.+#-]*$');
export const needRequirementsDesiredSkillsItemSourceQuoteOneMax = 300;
export const needRequirementsDesiredSkillsItemSourceExtractionVersionOneMax = 64;
export const needRequirementsDesiredSkillsItemSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsDesiredSkillsMax = 30;
export const needRequirementsTasksItemTextMax = 300;
export const needRequirementsTasksItemTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementsTasksItemSourceQuoteOneMax = 300;
export const needRequirementsTasksItemSourceExtractionVersionOneMax = 64;
export const needRequirementsTasksItemSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsTasksMax = 20;
export const needRequirementsDomainValueOneMax = 100;
export const needRequirementsDomainValueOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementsDomainSourceOneQuoteOneMax = 300;
export const needRequirementsDomainSourceOneExtractionVersionOneMax = 64;
export const needRequirementsDomainSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsWorkFormatsValueMax = 3;
export const needRequirementsWorkFormatsSourceOneQuoteOneMax = 300;
export const needRequirementsWorkFormatsSourceOneExtractionVersionOneMax = 64;
export const needRequirementsWorkFormatsSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsLocationValueOneMax = 100;
export const needRequirementsLocationValueOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementsLocationSourceOneQuoteOneMax = 300;
export const needRequirementsLocationSourceOneExtractionVersionOneMax = 64;
export const needRequirementsLocationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementsSalaryValueOneSalaryFromMin = 1000;
export const needRequirementsSalaryValueOneSalaryFromMax = 100000000;
export const needRequirementsSalaryValueOneSalaryFromMultipleOf = 1000;
export const needRequirementsSalaryValueOneSalaryToMin = 1000;
export const needRequirementsSalaryValueOneSalaryToMax = 100000000;
export const needRequirementsSalaryValueOneSalaryToMultipleOf = 1000;
export const needRequirementsSalarySourceOneQuoteOneMax = 300;
export const needRequirementsSalarySourceOneExtractionVersionOneMax = 64;
export const needRequirementsSalarySourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needReadinessMissingFieldsItemQuestionMax = 300;
export const needReadinessMissingFieldsMax = 9;
export const needRecommendationsAlgorithmVersionOneMax = 64;
export const needRecommendationsAlgorithmVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRecommendationsCategoriesItemScoreMin = 0;
export const needRecommendationsCategoriesItemScoreMax = 1;
export const needRecommendationsCategoriesItemSkillOverlapShareMin = 0;
export const needRecommendationsCategoriesItemSkillOverlapShareMax = 1;
export const needRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemMax = 100;
export const needRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRecommendationsCategoriesItemSkillOverlapCoveredSkillsMax = 60;
export const needRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemMax = 100;
export const needRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRecommendationsCategoriesItemSkillOverlapUncoveredSkillsMax = 60;
export const needRecommendationsCategoriesItemMoneyShareMin = 0;
export const needRecommendationsCategoriesItemMoneyShareMax = 1;
export const needRecommendationsCategoriesMax = 10;
export const Need = zod.object({
"id": zod.uuid().describe('Identifier of the need.'),
"organization_id": zod.uuid().describe('Organization that owns the need, equal to `org_id` of the path. It never changes.'),
"vacancy_id": zod.uuid().nullable().describe('Linked vacancy of the same organization, or null. A need never requires a vacancy.'),
"title": zod.string().min(1).max(needTitleMax).regex(needTitleRegExp).describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"source_text": zod.union([zod.string().min(1).max(needSourceTextOneMax).describe('Free description of the team\'s tasks as the employer wrote or pasted it. The server extracts proposed requirements from it; the text itself is never a requirement. It may contain line breaks. Plain text; clients show it as text, never as HTML. It describes the job and must not contain personal data of candidates. The server stores it as written: it may contain requirements that discriminate by a protected characteristic, and the extractor never turns such a requirement into a need field. Exclusions, the requirements that a candidate must not meet, are planned as a separate additive field with the Labor Code article 64 check (TASK-182).'),zod.null()]).describe('Text the requirements were extracted from, or null.'),
"version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),
"requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.').describe('Need version in which the current confirmed requirements were last changed, at most `version`. A change that confirms, changes, or removes a requirement makes it equal to the new `version`. A change of the title, the vacancy link, or the text, or of suggestions only, creates a new `version` but keeps `requirements_version`, so it invalidates neither the recommendations nor search results and selection snapshots. Search runs and selection snapshots (PRD FR10) refer to `(need id, requirements_version)`, and a new selection snapshot is due only when it changes.'),
"requirements": zod.object({
"specialization": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsSpecializationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsSpecializationSourceOneExtractionVersionOneMax).regex(needRequirementsSpecializationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target specialization of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.'),
"grade": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsGradeSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsGradeSourceOneExtractionVersionOneMax).regex(needRequirementsGradeSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target grade of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a text that names no grade leaves the grade unknown instead of assuming one.'),
"required_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needRequirementsRequiredSkillsItemNameMax).regex(needRequirementsRequiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"taxonomy_code": zod.union([zod.string().min(1).max(needRequirementsRequiredSkillsItemTaxonomyCodeOneMax).regex(needRequirementsRequiredSkillsItemTaxonomyCodeOneRegExp).describe('Code of a skill in the platform skill taxonomy, for example `postgresql`. The server assigns it from the taxonomy; clients never send it and never derive it from the name.'),zod.null()]),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsRequiredSkillsItemSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsRequiredSkillsItemSourceExtractionVersionOneMax).regex(needRequirementsRequiredSkillsItemSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One required or desired skill of the need. `taxonomy_code` is null for a skill that the platform taxonomy does not know: the server keeps the name as given, never maps it to a guessed code, and counts it as not covered in category recommendations.')).max(needRequirementsRequiredSkillsMax).describe('Required skills; each has weight 2 in skill coverage. Only confirmed skills count.'),
"desired_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needRequirementsDesiredSkillsItemNameMax).regex(needRequirementsDesiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"taxonomy_code": zod.union([zod.string().min(1).max(needRequirementsDesiredSkillsItemTaxonomyCodeOneMax).regex(needRequirementsDesiredSkillsItemTaxonomyCodeOneRegExp).describe('Code of a skill in the platform skill taxonomy, for example `postgresql`. The server assigns it from the taxonomy; clients never send it and never derive it from the name.'),zod.null()]),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsDesiredSkillsItemSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsDesiredSkillsItemSourceExtractionVersionOneMax).regex(needRequirementsDesiredSkillsItemSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One required or desired skill of the need. `taxonomy_code` is null for a skill that the platform taxonomy does not know: the server keeps the name as given, never maps it to a guessed code, and counts it as not covered in category recommendations.')).max(needRequirementsDesiredSkillsMax).describe('Desired skills; each has weight 1 in skill coverage. Only confirmed skills count.'),
"tasks": zod.array(zod.object({
"text": zod.string().min(1).max(needRequirementsTasksItemTextMax).regex(needRequirementsTasksItemTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsTasksItemSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsTasksItemSourceExtractionVersionOneMax).regex(needRequirementsTasksItemSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One work task of the team with its confirmation state and provenance.')).max(needRequirementsTasksMax).describe('Work tasks of the team in the order given.'),
"domain": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.string().min(1).max(needRequirementsDomainValueOneMax).regex(needRequirementsDomainValueOneRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsDomainSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsDomainSourceOneExtractionVersionOneMax).regex(needRequirementsDomainSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Business domain of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.'),
"work_formats": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(needRequirementsWorkFormatsValueMax).nullable(),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsWorkFormatsSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsWorkFormatsSourceOneExtractionVersionOneMax).regex(needRequirementsWorkFormatsSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Work formats that the employer offers, with their confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a known value lists one to three formats.'),
"location": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.string().min(1).max(needRequirementsLocationValueOneMax).regex(needRequirementsLocationValueOneRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsLocationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsLocationSourceOneExtractionVersionOneMax).regex(needRequirementsLocationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Place of work with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. Readiness requires a confirmed place only when the confirmed work formats include `office` or `hybrid`.'),
"salary": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.object({
"salary_from": zod.int().min(needRequirementsSalaryValueOneSalaryFromMin).max(needRequirementsSalaryValueOneSalaryFromMax).multipleOf(needRequirementsSalaryValueOneSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(needRequirementsSalaryValueOneSalaryToMin).max(needRequirementsSalaryValueOneSalaryToMax).multipleOf(needRequirementsSalaryValueOneSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementsSalarySourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementsSalarySourceOneExtractionVersionOneMax).regex(needRequirementsSalarySourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Salary range that the employer offers, with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. A text without a salary leaves it unknown; the server never substitutes zero, a market estimate, or a range from another need.')
}).describe('Requirements of one need version, each with its confirmation state and provenance. Read-only; requests change them through the fields of NeedCreate and NeedUpdate.'),
"readiness": zod.object({
"status": zod.enum(['complete', 'incomplete']).describe('`complete` when every critical field has a confirmed value, otherwise `incomplete`.'),
"missing_fields": zod.array(zod.object({
"field": zod.enum(['specialization', 'grade', 'required_skills', 'desired_skills', 'tasks', 'domain', 'work_formats', 'location', 'salary']).describe('Name of a need field, equal to its property name in NeedRequirementSet and in the request bodies. Adding a value is a contract change.'),
"reason": zod.enum(['unknown', 'unconfirmed']).describe('Why a critical field is missing: `unknown`, the field has no value, or `unconfirmed`, it has only an extracted value or, for required skills, only extracted items that wait for confirmation.'),
"question": zod.string().min(1).max(needReadinessMissingFieldsItemQuestionMax).describe('Specific Russian question about the missing value, for example which grade is needed. Plain text; the client shows it as text, never as HTML.')
}).describe('One critical field that has no confirmed value, with a specific question that the client shows next to the field.')).max(needReadinessMissingFieldsMax).describe('Critical fields without a confirmed value, each at most once, in the order of NeedFieldName. Empty exactly when `status` is `complete`.')
}).describe('Completeness of the critical fields, computed by the server for the current version. The critical fields are `specialization`, `grade`, `required_skills` (at least one confirmed skill), `work_formats`, `salary`, and `location` when the confirmed work formats include `office` or `hybrid`. An incomplete need is still a valid saved need; each later operation, such as search or an invitation, states which readiness it requires.'),
"recommendations": zod.object({
"status": zod.enum(['computed', 'pending', 'not_available']).describe('State of the category recommendations of the current requirements version.\n\n- computed: `categories` holds the recommendations computed from the confirmed requirements of `requirements_version`.\n- pending: the computation for the current requirements version has not finished yet; `categories` is empty. Read the need again later.\n- not_available: the current requirements have no confirmed required or desired skill to compute from; `categories` is empty.'),
"requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),
"policy_version": zod.int().min(1).nullable().describe('Number of the policy version whose weights were applied, or null unless `status` is `computed`.'),
"algorithm_version": zod.union([zod.string().min(1).max(needRecommendationsAlgorithmVersionOneMax).regex(needRecommendationsAlgorithmVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Version of the recommendation algorithm, or null unless `status` is `computed`.'),
"computed_at": zod.union([zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),zod.null()]).describe('Time of the computation, or null unless `status` is `computed`.'),
"categories": zod.array(zod.object({
"specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"score": zod.number().min(needRecommendationsCategoriesItemScoreMin).max(needRecommendationsCategoriesItemScoreMax).nullable().describe('Recommendation score from 0 to 1, rounded half up to two decimals, or null when `supply` is `fewer_than_5`. Read-only; no request can set it.'),
"skill_overlap": zod.object({
"share": zod.number().min(needRecommendationsCategoriesItemSkillOverlapShareMin).max(needRecommendationsCategoriesItemSkillOverlapShareMax).describe('Weighted share from 0 to 1, rounded to two decimals.'),
"covered_skills": zod.array(zod.string().min(1).max(needRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemMax).regex(needRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needRecommendationsCategoriesItemSkillOverlapCoveredSkillsMax).describe('Confirmed skills of the need that the category covers.'),
"uncovered_skills": zod.array(zod.string().min(1).max(needRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemMax).regex(needRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needRecommendationsCategoriesItemSkillOverlapUncoveredSkillsMax).describe('Confirmed skills of the need that the category does not cover, including skills without a taxonomy code.')
}).describe('Skill coverage of a category: the weighted share of the confirmed skills of the need that the category taxonomy covers, with weight 2 for a required and 1 for a desired skill.'),
"money": zod.object({
"status": zod.enum(['computed', 'insufficient_data', 'no_salary', 'withheld']).describe('How the salary component of a recommendation was obtained.\n\n- computed: at least five available candidates of the category have a known minimum comparable with the confirmed range; `share` is given.\n- insufficient_data: fewer than five such candidates; the policy uses the neutral value 0.5 and `share` is null.\n- no_salary: the need has no confirmed salary range; the policy uses the neutral value 0.5 and `share` is null.\n- withheld: the organization changed salary ranges five times within seven days, so salary aggregates are withheld for seven days (PRD FR13, planned in TASK-211); the policy uses the neutral value 0.5 and `share` is null.\n\nAn unknown candidate minimum never counts as zero.'),
"share": zod.number().min(needRecommendationsCategoriesItemMoneyShareMin).max(needRecommendationsCategoriesItemMoneyShareMax).nullable().describe('Share of those candidates whose minimum is not above the upper bound of the range, rounded down to a multiple of 0.25 (one of 0, 0.25, 0.5, 0.75, 1), or null unless `status` is `computed`. The score and the ranking use this rounded value, never the exact share. A quarter step gives five levels: each probe of a new upper bound tells at most which quarter of the group accepts it, and in the smallest allowed group of five candidates a single minimum often does not move the value, while the share still separates a range that most candidates accept from one that few accept.')
}).describe('Salary component of a recommendation. It is an aggregate over at least five candidates and never reveals a minimum of any candidate.'),
"supply": zod.enum(['fewer_than_5', 'from_5_to_29', '30_or_more']).describe('Number of available candidates of the category in the allowed detail: `fewer_than_5`, `from_5_to_29`, or `30_or_more`. Smaller groups are never counted exactly.')
}).describe('One recommended category, a specialization with a grade, with its score and the reasons for it. The score is `0.5 * Overlap + 0.3 * Money + 0.2 * Supply` (PRD FR08) computed from the published components: the exact skill overlap, the money share rounded down to a quarter or the neutral 0.5, and `Supply = min(1, active / 30)` when at least five candidates are available. For a group of fewer than five, Supply enters the ranking as 0, the same for every such group, so neither the score nor the order reveals the exact size of a group below five.')).max(needRecommendationsCategoriesMax).describe('Recommended categories, best first by the score described in NeedCategoryRecommendation. Empty unless `status` is `computed`.')
}).describe('Category recommendations computed by the server from the confirmed requirements of `requirements_version` with a versioned policy (PRD FR08). Read-only: no request can set a recommendation, a score, or one of its components. The server may recompute them for the same requirements version, for example for a new policy or a changed pool of available candidates, without a new need version; `computed_at` and `policy_version` then change. The policy version and the candidate group used are stored with each computation, so a later policy never rewrites it.'),
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),
"updated_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.')
}).describe('Hiring need of an organization: what the team needs, independent of any published vacancy. It holds the current version of the requirements with their provenance, the readiness of the critical fields, and the category recommendations. It never contains membership data, a candidate\'s personal data, or a candidate\'s salary minimum.')
export type Need = zod.input<typeof Need>;
export type NeedOutput = zod.output<typeof Need>;
@@ -0,0 +1,48 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needCategoryRecommendationScoreMin = 0;
export const needCategoryRecommendationScoreMax = 1;
export const needCategoryRecommendationSkillOverlapShareMin = 0;
export const needCategoryRecommendationSkillOverlapShareMax = 1;
export const needCategoryRecommendationSkillOverlapCoveredSkillsItemMax = 100;
export const needCategoryRecommendationSkillOverlapCoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCategoryRecommendationSkillOverlapCoveredSkillsMax = 60;
export const needCategoryRecommendationSkillOverlapUncoveredSkillsItemMax = 100;
export const needCategoryRecommendationSkillOverlapUncoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCategoryRecommendationSkillOverlapUncoveredSkillsMax = 60;
export const needCategoryRecommendationMoneyShareMin = 0;
export const needCategoryRecommendationMoneyShareMax = 1;
export const NeedCategoryRecommendation = zod.object({
"specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"score": zod.number().min(needCategoryRecommendationScoreMin).max(needCategoryRecommendationScoreMax).nullable().describe('Recommendation score from 0 to 1, rounded half up to two decimals, or null when `supply` is `fewer_than_5`. Read-only; no request can set it.'),
"skill_overlap": zod.object({
"share": zod.number().min(needCategoryRecommendationSkillOverlapShareMin).max(needCategoryRecommendationSkillOverlapShareMax).describe('Weighted share from 0 to 1, rounded to two decimals.'),
"covered_skills": zod.array(zod.string().min(1).max(needCategoryRecommendationSkillOverlapCoveredSkillsItemMax).regex(needCategoryRecommendationSkillOverlapCoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needCategoryRecommendationSkillOverlapCoveredSkillsMax).describe('Confirmed skills of the need that the category covers.'),
"uncovered_skills": zod.array(zod.string().min(1).max(needCategoryRecommendationSkillOverlapUncoveredSkillsItemMax).regex(needCategoryRecommendationSkillOverlapUncoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needCategoryRecommendationSkillOverlapUncoveredSkillsMax).describe('Confirmed skills of the need that the category does not cover, including skills without a taxonomy code.')
}).describe('Skill coverage of a category: the weighted share of the confirmed skills of the need that the category taxonomy covers, with weight 2 for a required and 1 for a desired skill.'),
"money": zod.object({
"status": zod.enum(['computed', 'insufficient_data', 'no_salary', 'withheld']).describe('How the salary component of a recommendation was obtained.\n\n- computed: at least five available candidates of the category have a known minimum comparable with the confirmed range; `share` is given.\n- insufficient_data: fewer than five such candidates; the policy uses the neutral value 0.5 and `share` is null.\n- no_salary: the need has no confirmed salary range; the policy uses the neutral value 0.5 and `share` is null.\n- withheld: the organization changed salary ranges five times within seven days, so salary aggregates are withheld for seven days (PRD FR13, planned in TASK-211); the policy uses the neutral value 0.5 and `share` is null.\n\nAn unknown candidate minimum never counts as zero.'),
"share": zod.number().min(needCategoryRecommendationMoneyShareMin).max(needCategoryRecommendationMoneyShareMax).nullable().describe('Share of those candidates whose minimum is not above the upper bound of the range, rounded down to a multiple of 0.25 (one of 0, 0.25, 0.5, 0.75, 1), or null unless `status` is `computed`. The score and the ranking use this rounded value, never the exact share. A quarter step gives five levels: each probe of a new upper bound tells at most which quarter of the group accepts it, and in the smallest allowed group of five candidates a single minimum often does not move the value, while the share still separates a range that most candidates accept from one that few accept.')
}).describe('Salary component of a recommendation. It is an aggregate over at least five candidates and never reveals a minimum of any candidate.'),
"supply": zod.enum(['fewer_than_5', 'from_5_to_29', '30_or_more']).describe('Number of available candidates of the category in the allowed detail: `fewer_than_5`, `from_5_to_29`, or `30_or_more`. Smaller groups are never counted exactly.')
}).describe('One recommended category, a specialization with a grade, with its score and the reasons for it. The score is `0.5 * Overlap + 0.3 * Money + 0.2 * Supply` (PRD FR08) computed from the published components: the exact skill overlap, the money share rounded down to a quarter or the neutral 0.5, and `Supply = min(1, active / 30)` when at least five candidates are available. For a group of fewer than five, Supply enters the ranking as 0, the same for every such group, so neither the score nor the order reveals the exact size of a group below five.')
export type NeedCategoryRecommendation = zod.input<typeof NeedCategoryRecommendation>;
export type NeedCategoryRecommendationOutput = zod.output<typeof NeedCategoryRecommendation>;
@@ -0,0 +1,63 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needCategoryRecommendationsAlgorithmVersionOneMax = 64;
export const needCategoryRecommendationsAlgorithmVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needCategoryRecommendationsCategoriesItemScoreMin = 0;
export const needCategoryRecommendationsCategoriesItemScoreMax = 1;
export const needCategoryRecommendationsCategoriesItemSkillOverlapShareMin = 0;
export const needCategoryRecommendationsCategoriesItemSkillOverlapShareMax = 1;
export const needCategoryRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemMax = 100;
export const needCategoryRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCategoryRecommendationsCategoriesItemSkillOverlapCoveredSkillsMax = 60;
export const needCategoryRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemMax = 100;
export const needCategoryRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCategoryRecommendationsCategoriesItemSkillOverlapUncoveredSkillsMax = 60;
export const needCategoryRecommendationsCategoriesItemMoneyShareMin = 0;
export const needCategoryRecommendationsCategoriesItemMoneyShareMax = 1;
export const needCategoryRecommendationsCategoriesMax = 10;
export const NeedCategoryRecommendations = zod.object({
"status": zod.enum(['computed', 'pending', 'not_available']).describe('State of the category recommendations of the current requirements version.\n\n- computed: `categories` holds the recommendations computed from the confirmed requirements of `requirements_version`.\n- pending: the computation for the current requirements version has not finished yet; `categories` is empty. Read the need again later.\n- not_available: the current requirements have no confirmed required or desired skill to compute from; `categories` is empty.'),
"requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),
"policy_version": zod.int().min(1).nullable().describe('Number of the policy version whose weights were applied, or null unless `status` is `computed`.'),
"algorithm_version": zod.union([zod.string().min(1).max(needCategoryRecommendationsAlgorithmVersionOneMax).regex(needCategoryRecommendationsAlgorithmVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Version of the recommendation algorithm, or null unless `status` is `computed`.'),
"computed_at": zod.union([zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),zod.null()]).describe('Time of the computation, or null unless `status` is `computed`.'),
"categories": zod.array(zod.object({
"specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"score": zod.number().min(needCategoryRecommendationsCategoriesItemScoreMin).max(needCategoryRecommendationsCategoriesItemScoreMax).nullable().describe('Recommendation score from 0 to 1, rounded half up to two decimals, or null when `supply` is `fewer_than_5`. Read-only; no request can set it.'),
"skill_overlap": zod.object({
"share": zod.number().min(needCategoryRecommendationsCategoriesItemSkillOverlapShareMin).max(needCategoryRecommendationsCategoriesItemSkillOverlapShareMax).describe('Weighted share from 0 to 1, rounded to two decimals.'),
"covered_skills": zod.array(zod.string().min(1).max(needCategoryRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemMax).regex(needCategoryRecommendationsCategoriesItemSkillOverlapCoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needCategoryRecommendationsCategoriesItemSkillOverlapCoveredSkillsMax).describe('Confirmed skills of the need that the category covers.'),
"uncovered_skills": zod.array(zod.string().min(1).max(needCategoryRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemMax).regex(needCategoryRecommendationsCategoriesItemSkillOverlapUncoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needCategoryRecommendationsCategoriesItemSkillOverlapUncoveredSkillsMax).describe('Confirmed skills of the need that the category does not cover, including skills without a taxonomy code.')
}).describe('Skill coverage of a category: the weighted share of the confirmed skills of the need that the category taxonomy covers, with weight 2 for a required and 1 for a desired skill.'),
"money": zod.object({
"status": zod.enum(['computed', 'insufficient_data', 'no_salary', 'withheld']).describe('How the salary component of a recommendation was obtained.\n\n- computed: at least five available candidates of the category have a known minimum comparable with the confirmed range; `share` is given.\n- insufficient_data: fewer than five such candidates; the policy uses the neutral value 0.5 and `share` is null.\n- no_salary: the need has no confirmed salary range; the policy uses the neutral value 0.5 and `share` is null.\n- withheld: the organization changed salary ranges five times within seven days, so salary aggregates are withheld for seven days (PRD FR13, planned in TASK-211); the policy uses the neutral value 0.5 and `share` is null.\n\nAn unknown candidate minimum never counts as zero.'),
"share": zod.number().min(needCategoryRecommendationsCategoriesItemMoneyShareMin).max(needCategoryRecommendationsCategoriesItemMoneyShareMax).nullable().describe('Share of those candidates whose minimum is not above the upper bound of the range, rounded down to a multiple of 0.25 (one of 0, 0.25, 0.5, 0.75, 1), or null unless `status` is `computed`. The score and the ranking use this rounded value, never the exact share. A quarter step gives five levels: each probe of a new upper bound tells at most which quarter of the group accepts it, and in the smallest allowed group of five candidates a single minimum often does not move the value, while the share still separates a range that most candidates accept from one that few accept.')
}).describe('Salary component of a recommendation. It is an aggregate over at least five candidates and never reveals a minimum of any candidate.'),
"supply": zod.enum(['fewer_than_5', 'from_5_to_29', '30_or_more']).describe('Number of available candidates of the category in the allowed detail: `fewer_than_5`, `from_5_to_29`, or `30_or_more`. Smaller groups are never counted exactly.')
}).describe('One recommended category, a specialization with a grade, with its score and the reasons for it. The score is `0.5 * Overlap + 0.3 * Money + 0.2 * Supply` (PRD FR08) computed from the published components: the exact skill overlap, the money share rounded down to a quarter or the neutral 0.5, and `Supply = min(1, active / 30)` when at least five candidates are available. For a group of fewer than five, Supply enters the ranking as 0, the same for every such group, so neither the score nor the order reveals the exact size of a group below five.')).max(needCategoryRecommendationsCategoriesMax).describe('Recommended categories, best first by the score described in NeedCategoryRecommendation. Empty unless `status` is `computed`.')
}).describe('Category recommendations computed by the server from the confirmed requirements of `requirements_version` with a versioned policy (PRD FR08). Read-only: no request can set a recommendation, a score, or one of its components. The server may recompute them for the same requirements version, for example for a new policy or a changed pool of available candidates, without a new need version; `computed_at` and `policy_version` then change. The policy version and the candidate group used are stored with each computation, so a later policy never rewrites it.')
export type NeedCategoryRecommendations = zod.input<typeof NeedCategoryRecommendations>;
export type NeedCategoryRecommendationsOutput = zod.output<typeof NeedCategoryRecommendations>;
@@ -0,0 +1,101 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needCreateTitleMax = 200;
export const needCreateTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCreateSourceTextOneMax = 10000;
export const needCreateRequiredSkillsItemNameMax = 100;
export const needCreateRequiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCreateRequiredSkillsMax = 30;
export const needCreateDesiredSkillsItemNameMax = 100;
export const needCreateDesiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCreateDesiredSkillsMax = 30;
export const needCreateTasksItemTextMax = 300;
export const needCreateTasksItemTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCreateTasksMax = 20;
export const needCreateDomainOneValueMax = 100;
export const needCreateDomainOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCreateWorkFormatsOneValueMax = 3;
export const needCreateLocationOneValueMax = 100;
export const needCreateLocationOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needCreateSalaryOneValueSalaryFromMin = 1000;
export const needCreateSalaryOneValueSalaryFromMax = 100000000;
export const needCreateSalaryOneValueSalaryFromMultipleOf = 1000;
export const needCreateSalaryOneValueSalaryToMin = 1000;
export const needCreateSalaryOneValueSalaryToMax = 100000000;
export const needCreateSalaryOneValueSalaryToMultipleOf = 1000;
export const NeedCreate = zod.object({
"title": zod.string().min(1).max(needCreateTitleMax).regex(needCreateTitleRegExp).describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"vacancy_id": zod.uuid().nullish().describe('Vacancy of the same organization to link, or null or absent for a need without a vacancy.'),
"source_text": zod.union([zod.string().min(1).max(needCreateSourceTextOneMax).describe('Free description of the team\'s tasks as the employer wrote or pasted it. The server extracts proposed requirements from it; the text itself is never a requirement. It may contain line breaks. Plain text; clients show it as text, never as HTML. It describes the job and must not contain personal data of candidates. The server stores it as written: it may contain requirements that discriminate by a protected characteristic, and the extractor never turns such a requirement into a need field. Exclusions, the requirements that a candidate must not meet, are planned as a separate additive field with the Labor Code article 64 check (TASK-182).'),zod.null()]).exactOptional(),
"specialization": zod.union([zod.object({
"value": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the specialization in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"grade": zod.union([zod.object({
"value": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the grade in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"required_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needCreateRequiredSkillsItemNameMax).regex(needCreateRequiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(needCreateRequiredSkillsMax).exactOptional(),
"desired_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needCreateDesiredSkillsItemNameMax).regex(needCreateDesiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(needCreateDesiredSkillsMax).exactOptional(),
"tasks": zod.array(zod.object({
"text": zod.string().min(1).max(needCreateTasksItemTextMax).regex(needCreateTasksItemTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One task of the list in a request. A text equal to a task of the current version refers to that task and keeps its origin and quote; any other text is a new manual task. `status` and repeated texts follow the rules of NeedSkillInput.')).max(needCreateTasksMax).exactOptional(),
"domain": zod.union([zod.object({
"value": zod.string().min(1).max(needCreateDomainOneValueMax).regex(needCreateDomainOneValueRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the domain in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"work_formats": zod.union([zod.object({
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(needCreateWorkFormatsOneValueMax),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the work formats in a request; see NeedUpdate for the rules of `status`. Formats are compared as a set.'),zod.null()]).exactOptional(),
"location": zod.union([zod.object({
"value": zod.string().min(1).max(needCreateLocationOneValueMax).regex(needCreateLocationOneValueRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the place of work in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"salary": zod.union([zod.object({
"value": zod.object({
"salary_from": zod.int().min(needCreateSalaryOneValueSalaryFromMin).max(needCreateSalaryOneValueSalaryFromMax).multipleOf(needCreateSalaryOneValueSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(needCreateSalaryOneValueSalaryToMin).max(needCreateSalaryOneValueSalaryToMax).multipleOf(needCreateSalaryOneValueSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the salary range in a request; see NeedUpdate for the rules of `status` and SalaryRange for the rules of the range, whose pointers are under `/salary/value`.'),zod.null()]).exactOptional()
}).describe('New need. Only `title` is required, so a need can start from a title, from a text, or from form fields, and with or without a vacancy. A field or list item given here must have `status` `confirmed` and becomes a confirmed manual value; `extracted` answers 400 with the pointer of that `status`, such as `/grade/status`, because a new need has no stored suggestion. A field that is absent is extracted from `source_text` when the text is given and is left unknown or empty otherwise. A nullable field sent as null, and a skill or task list sent as an empty list, stays unknown or empty and is not extracted; an empty `work_formats` value fails `minItems`. Unknown fields are rejected, so a request cannot set membership, a role, a status of the need, a provenance, readiness, a recommendation or its score, or a candidate\'s salary minimum.')
export type NeedCreate = zod.input<typeof NeedCreate>;
export type NeedCreateOutput = zod.output<typeof NeedCreate>;
@@ -0,0 +1,33 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needDomainValueOneMax = 100;
export const needDomainValueOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needDomainSourceOneQuoteOneMax = 300;
export const needDomainSourceOneExtractionVersionOneMax = 64;
export const needDomainSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedDomain = zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.string().min(1).max(needDomainValueOneMax).regex(needDomainValueOneRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needDomainSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needDomainSourceOneExtractionVersionOneMax).regex(needDomainSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Business domain of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.')
export type NeedDomain = zod.input<typeof NeedDomain>;
export type NeedDomainOutput = zod.output<typeof NeedDomain>;
@@ -0,0 +1,20 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needDomainInputValueMax = 100;
export const needDomainInputValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedDomainInput = zod.object({
"value": zod.string().min(1).max(needDomainInputValueMax).regex(needDomainInputValueRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the domain in a request; see NeedUpdate for the rules of `status`.')
export type NeedDomainInput = zod.input<typeof NeedDomainInput>;
export type NeedDomainInputOutput = zod.output<typeof NeedDomainInput>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedDomainNameMax = 100;
export const NeedDomainNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedDomainName = zod.string().min(1).max(NeedDomainNameMax).regex(NeedDomainNameRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.')
export type NeedDomainName = zod.input<typeof NeedDomainName>;
export type NeedDomainNameOutput = zod.output<typeof NeedDomainName>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedFieldName = zod.enum(['specialization', 'grade', 'required_skills', 'desired_skills', 'tasks', 'domain', 'work_formats', 'location', 'salary']).describe('Name of a need field, equal to its property name in NeedRequirementSet and in the request bodies. Adding a value is a contract change.')
export type NeedFieldName = zod.input<typeof NeedFieldName>;
export type NeedFieldNameOutput = zod.output<typeof NeedFieldName>;
@@ -0,0 +1,29 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needGradeSourceOneQuoteOneMax = 300;
export const needGradeSourceOneExtractionVersionOneMax = 64;
export const needGradeSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedGrade = zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needGradeSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needGradeSourceOneExtractionVersionOneMax).regex(needGradeSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target grade of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a text that names no grade leaves the grade unknown instead of assuming one.')
export type NeedGrade = zod.input<typeof NeedGrade>;
export type NeedGradeOutput = zod.output<typeof NeedGrade>;
@@ -0,0 +1,15 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedGradeInput = zod.object({
"value": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the grade in a request; see NeedUpdate for the rules of `status`.')
export type NeedGradeInput = zod.input<typeof NeedGradeInput>;
export type NeedGradeInputOutput = zod.output<typeof NeedGradeInput>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedItemStatus = zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
export type NeedItemStatus = zod.input<typeof NeedItemStatus>;
export type NeedItemStatusOutput = zod.output<typeof NeedItemStatus>;
@@ -0,0 +1,83 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needListItemsItemTitleMax = 200;
export const needListItemsItemTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needListItemsItemSpecializationSourceOneQuoteOneMax = 300;
export const needListItemsItemSpecializationSourceOneExtractionVersionOneMax = 64;
export const needListItemsItemSpecializationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needListItemsItemGradeSourceOneQuoteOneMax = 300;
export const needListItemsItemGradeSourceOneExtractionVersionOneMax = 64;
export const needListItemsItemGradeSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needListItemsItemReadinessMissingFieldsItemQuestionMax = 300;
export const needListItemsItemReadinessMissingFieldsMax = 9;
export const needListItemsMax = 100;
export const needListPageNextCursorMax = 512;
export const needListPageNextCursorRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const NeedList = zod.object({
"items": zod.array(zod.object({
"id": zod.uuid().describe('Identifier of the need.'),
"vacancy_id": zod.uuid().nullable().describe('Linked vacancy, or null.'),
"title": zod.string().min(1).max(needListItemsItemTitleMax).regex(needListItemsItemTitleRegExp).describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),
"specialization": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needListItemsItemSpecializationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needListItemsItemSpecializationSourceOneExtractionVersionOneMax).regex(needListItemsItemSpecializationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target specialization of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.'),
"grade": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needListItemsItemGradeSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needListItemsItemGradeSourceOneExtractionVersionOneMax).regex(needListItemsItemGradeSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target grade of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a text that names no grade leaves the grade unknown instead of assuming one.'),
"readiness": zod.object({
"status": zod.enum(['complete', 'incomplete']).describe('`complete` when every critical field has a confirmed value, otherwise `incomplete`.'),
"missing_fields": zod.array(zod.object({
"field": zod.enum(['specialization', 'grade', 'required_skills', 'desired_skills', 'tasks', 'domain', 'work_formats', 'location', 'salary']).describe('Name of a need field, equal to its property name in NeedRequirementSet and in the request bodies. Adding a value is a contract change.'),
"reason": zod.enum(['unknown', 'unconfirmed']).describe('Why a critical field is missing: `unknown`, the field has no value, or `unconfirmed`, it has only an extracted value or, for required skills, only extracted items that wait for confirmation.'),
"question": zod.string().min(1).max(needListItemsItemReadinessMissingFieldsItemQuestionMax).describe('Specific Russian question about the missing value, for example which grade is needed. Plain text; the client shows it as text, never as HTML.')
}).describe('One critical field that has no confirmed value, with a specific question that the client shows next to the field.')).max(needListItemsItemReadinessMissingFieldsMax).describe('Critical fields without a confirmed value, each at most once, in the order of NeedFieldName. Empty exactly when `status` is `complete`.')
}).describe('Completeness of the critical fields, computed by the server for the current version. The critical fields are `specialization`, `grade`, `required_skills` (at least one confirmed skill), `work_formats`, `salary`, and `location` when the confirmed work formats include `office` or `hybrid`. An incomplete need is still a valid saved need; each later operation, such as search or an invitation, states which readiness it requires.'),
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),
"updated_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.')
}).describe('Need in a list: its identity, current version, target category fields, and readiness. Read the need for the requirements and the recommendations.')).max(needListItemsMax).describe('Needs of the page.'),
"page": zod.object({
"has_more": zod.boolean().describe('Whether another page follows this one.'),
"next_cursor": zod.string().min(1).max(needListPageNextCursorMax).regex(needListPageNextCursorRegExp).nullable().describe('Opaque cursor of the next page, or null on the last page. Clients must not parse, build, or store it beyond the current listing.')
}).describe('Cursor pagination state of a list response. Lists are ordered by a stable server-defined key. To read the next page, repeat the request with the same filters and `cursor` set to `next_cursor`.')
}).describe('One page of the needs of an organization, newest first by creation time.')
export type NeedList = zod.input<typeof NeedList>;
export type NeedListOutput = zod.output<typeof NeedList>;
@@ -0,0 +1,33 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needLocationValueOneMax = 100;
export const needLocationValueOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needLocationSourceOneQuoteOneMax = 300;
export const needLocationSourceOneExtractionVersionOneMax = 64;
export const needLocationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedLocation = zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.string().min(1).max(needLocationValueOneMax).regex(needLocationValueOneRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needLocationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needLocationSourceOneExtractionVersionOneMax).regex(needLocationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Place of work with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. Readiness requires a confirmed place only when the confirmed work formats include `office` or `hybrid`.')
export type NeedLocation = zod.input<typeof NeedLocation>;
export type NeedLocationOutput = zod.output<typeof NeedLocation>;
@@ -0,0 +1,20 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needLocationInputValueMax = 100;
export const needLocationInputValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedLocationInput = zod.object({
"value": zod.string().min(1).max(needLocationInputValueMax).regex(needLocationInputValueRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the place of work in a request; see NeedUpdate for the rules of `status`.')
export type NeedLocationInput = zod.input<typeof NeedLocationInput>;
export type NeedLocationInputOutput = zod.output<typeof NeedLocationInput>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedLocationNameMax = 100;
export const NeedLocationNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedLocationName = zod.string().min(1).max(NeedLocationNameMax).regex(NeedLocationNameRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.')
export type NeedLocationName = zod.input<typeof NeedLocationName>;
export type NeedLocationNameOutput = zod.output<typeof NeedLocationName>;
@@ -0,0 +1,19 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needMissingFieldQuestionMax = 300;
export const NeedMissingField = zod.object({
"field": zod.enum(['specialization', 'grade', 'required_skills', 'desired_skills', 'tasks', 'domain', 'work_formats', 'location', 'salary']).describe('Name of a need field, equal to its property name in NeedRequirementSet and in the request bodies. Adding a value is a contract change.'),
"reason": zod.enum(['unknown', 'unconfirmed']).describe('Why a critical field is missing: `unknown`, the field has no value, or `unconfirmed`, it has only an extracted value or, for required skills, only extracted items that wait for confirmation.'),
"question": zod.string().min(1).max(needMissingFieldQuestionMax).describe('Specific Russian question about the missing value, for example which grade is needed. Plain text; the client shows it as text, never as HTML.')
}).describe('One critical field that has no confirmed value, with a specific question that the client shows next to the field.')
export type NeedMissingField = zod.input<typeof NeedMissingField>;
export type NeedMissingFieldOutput = zod.output<typeof NeedMissingField>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedMissingReason = zod.enum(['unknown', 'unconfirmed']).describe('Why a critical field is missing: `unknown`, the field has no value, or `unconfirmed`, it has only an extracted value or, for required skills, only extracted items that wait for confirmation.')
export type NeedMissingReason = zod.input<typeof NeedMissingReason>;
export type NeedMissingReasonOutput = zod.output<typeof NeedMissingReason>;
@@ -0,0 +1,19 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needMoneyFitShareMin = 0;
export const needMoneyFitShareMax = 1;
export const NeedMoneyFit = zod.object({
"status": zod.enum(['computed', 'insufficient_data', 'no_salary', 'withheld']).describe('How the salary component of a recommendation was obtained.\n\n- computed: at least five available candidates of the category have a known minimum comparable with the confirmed range; `share` is given.\n- insufficient_data: fewer than five such candidates; the policy uses the neutral value 0.5 and `share` is null.\n- no_salary: the need has no confirmed salary range; the policy uses the neutral value 0.5 and `share` is null.\n- withheld: the organization changed salary ranges five times within seven days, so salary aggregates are withheld for seven days (PRD FR13, planned in TASK-211); the policy uses the neutral value 0.5 and `share` is null.\n\nAn unknown candidate minimum never counts as zero.'),
"share": zod.number().min(needMoneyFitShareMin).max(needMoneyFitShareMax).nullable().describe('Share of those candidates whose minimum is not above the upper bound of the range, rounded down to a multiple of 0.25 (one of 0, 0.25, 0.5, 0.75, 1), or null unless `status` is `computed`. The score and the ranking use this rounded value, never the exact share. A quarter step gives five levels: each probe of a new upper bound tells at most which quarter of the group accepts it, and in the smallest allowed group of five candidates a single minimum often does not move the value, while the share still separates a range that most candidates accept from one that few accept.')
}).describe('Salary component of a recommendation. It is an aggregate over at least five candidates and never reveals a minimum of any candidate.')
export type NeedMoneyFit = zod.input<typeof NeedMoneyFit>;
export type NeedMoneyFitOutput = zod.output<typeof NeedMoneyFit>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedMoneyStatus = zod.enum(['computed', 'insufficient_data', 'no_salary', 'withheld']).describe('How the salary component of a recommendation was obtained.\n\n- computed: at least five available candidates of the category have a known minimum comparable with the confirmed range; `share` is given.\n- insufficient_data: fewer than five such candidates; the policy uses the neutral value 0.5 and `share` is null.\n- no_salary: the need has no confirmed salary range; the policy uses the neutral value 0.5 and `share` is null.\n- withheld: the organization changed salary ranges five times within seven days, so salary aggregates are withheld for seven days (PRD FR13, planned in TASK-211); the policy uses the neutral value 0.5 and `share` is null.\n\nAn unknown candidate minimum never counts as zero.')
export type NeedMoneyStatus = zod.input<typeof NeedMoneyStatus>;
export type NeedMoneyStatusOutput = zod.output<typeof NeedMoneyStatus>;
@@ -0,0 +1,24 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needReadinessReportMissingFieldsItemQuestionMax = 300;
export const needReadinessReportMissingFieldsMax = 9;
export const NeedReadinessReport = zod.object({
"status": zod.enum(['complete', 'incomplete']).describe('`complete` when every critical field has a confirmed value, otherwise `incomplete`.'),
"missing_fields": zod.array(zod.object({
"field": zod.enum(['specialization', 'grade', 'required_skills', 'desired_skills', 'tasks', 'domain', 'work_formats', 'location', 'salary']).describe('Name of a need field, equal to its property name in NeedRequirementSet and in the request bodies. Adding a value is a contract change.'),
"reason": zod.enum(['unknown', 'unconfirmed']).describe('Why a critical field is missing: `unknown`, the field has no value, or `unconfirmed`, it has only an extracted value or, for required skills, only extracted items that wait for confirmation.'),
"question": zod.string().min(1).max(needReadinessReportMissingFieldsItemQuestionMax).describe('Specific Russian question about the missing value, for example which grade is needed. Plain text; the client shows it as text, never as HTML.')
}).describe('One critical field that has no confirmed value, with a specific question that the client shows next to the field.')).max(needReadinessReportMissingFieldsMax).describe('Critical fields without a confirmed value, each at most once, in the order of NeedFieldName. Empty exactly when `status` is `complete`.')
}).describe('Completeness of the critical fields, computed by the server for the current version. The critical fields are `specialization`, `grade`, `required_skills` (at least one confirmed skill), `work_formats`, `salary`, and `location` when the confirmed work formats include `office` or `hybrid`. An incomplete need is still a valid saved need; each later operation, such as search or an invitation, states which readiness it requires.')
export type NeedReadinessReport = zod.input<typeof NeedReadinessReport>;
export type NeedReadinessReportOutput = zod.output<typeof NeedReadinessReport>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedReadinessStatus = zod.enum(['complete', 'incomplete']).describe('`complete` when every critical field has a confirmed value, otherwise `incomplete`.')
export type NeedReadinessStatus = zod.input<typeof NeedReadinessStatus>;
export type NeedReadinessStatusOutput = zod.output<typeof NeedReadinessStatus>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedRecommendationStatus = zod.enum(['computed', 'pending', 'not_available']).describe('State of the category recommendations of the current requirements version.\n\n- computed: `categories` holds the recommendations computed from the confirmed requirements of `requirements_version`.\n- pending: the computation for the current requirements version has not finished yet; `categories` is empty. Read the need again later.\n- not_available: the current requirements have no confirmed required or desired skill to compute from; `categories` is empty.')
export type NeedRecommendationStatus = zod.input<typeof NeedRecommendationStatus>;
export type NeedRecommendationStatusOutput = zod.output<typeof NeedRecommendationStatus>;
@@ -0,0 +1,219 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needRequirementSetSpecializationSourceOneQuoteOneMax = 300;
export const needRequirementSetSpecializationSourceOneExtractionVersionOneMax = 64;
export const needRequirementSetSpecializationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetGradeSourceOneQuoteOneMax = 300;
export const needRequirementSetGradeSourceOneExtractionVersionOneMax = 64;
export const needRequirementSetGradeSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetRequiredSkillsItemNameMax = 100;
export const needRequirementSetRequiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementSetRequiredSkillsItemTaxonomyCodeOneMax = 64;
export const needRequirementSetRequiredSkillsItemTaxonomyCodeOneRegExp = new RegExp('^[a-z0-9][a-z0-9_.+#-]*$');
export const needRequirementSetRequiredSkillsItemSourceQuoteOneMax = 300;
export const needRequirementSetRequiredSkillsItemSourceExtractionVersionOneMax = 64;
export const needRequirementSetRequiredSkillsItemSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetRequiredSkillsMax = 30;
export const needRequirementSetDesiredSkillsItemNameMax = 100;
export const needRequirementSetDesiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementSetDesiredSkillsItemTaxonomyCodeOneMax = 64;
export const needRequirementSetDesiredSkillsItemTaxonomyCodeOneRegExp = new RegExp('^[a-z0-9][a-z0-9_.+#-]*$');
export const needRequirementSetDesiredSkillsItemSourceQuoteOneMax = 300;
export const needRequirementSetDesiredSkillsItemSourceExtractionVersionOneMax = 64;
export const needRequirementSetDesiredSkillsItemSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetDesiredSkillsMax = 30;
export const needRequirementSetTasksItemTextMax = 300;
export const needRequirementSetTasksItemTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementSetTasksItemSourceQuoteOneMax = 300;
export const needRequirementSetTasksItemSourceExtractionVersionOneMax = 64;
export const needRequirementSetTasksItemSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetTasksMax = 20;
export const needRequirementSetDomainValueOneMax = 100;
export const needRequirementSetDomainValueOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementSetDomainSourceOneQuoteOneMax = 300;
export const needRequirementSetDomainSourceOneExtractionVersionOneMax = 64;
export const needRequirementSetDomainSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetWorkFormatsValueMax = 3;
export const needRequirementSetWorkFormatsSourceOneQuoteOneMax = 300;
export const needRequirementSetWorkFormatsSourceOneExtractionVersionOneMax = 64;
export const needRequirementSetWorkFormatsSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetLocationValueOneMax = 100;
export const needRequirementSetLocationValueOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needRequirementSetLocationSourceOneQuoteOneMax = 300;
export const needRequirementSetLocationSourceOneExtractionVersionOneMax = 64;
export const needRequirementSetLocationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needRequirementSetSalaryValueOneSalaryFromMin = 1000;
export const needRequirementSetSalaryValueOneSalaryFromMax = 100000000;
export const needRequirementSetSalaryValueOneSalaryFromMultipleOf = 1000;
export const needRequirementSetSalaryValueOneSalaryToMin = 1000;
export const needRequirementSetSalaryValueOneSalaryToMax = 100000000;
export const needRequirementSetSalaryValueOneSalaryToMultipleOf = 1000;
export const needRequirementSetSalarySourceOneQuoteOneMax = 300;
export const needRequirementSetSalarySourceOneExtractionVersionOneMax = 64;
export const needRequirementSetSalarySourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedRequirementSet = zod.object({
"specialization": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetSpecializationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetSpecializationSourceOneExtractionVersionOneMax).regex(needRequirementSetSpecializationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target specialization of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.'),
"grade": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetGradeSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetGradeSourceOneExtractionVersionOneMax).regex(needRequirementSetGradeSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target grade of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a text that names no grade leaves the grade unknown instead of assuming one.'),
"required_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needRequirementSetRequiredSkillsItemNameMax).regex(needRequirementSetRequiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"taxonomy_code": zod.union([zod.string().min(1).max(needRequirementSetRequiredSkillsItemTaxonomyCodeOneMax).regex(needRequirementSetRequiredSkillsItemTaxonomyCodeOneRegExp).describe('Code of a skill in the platform skill taxonomy, for example `postgresql`. The server assigns it from the taxonomy; clients never send it and never derive it from the name.'),zod.null()]),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetRequiredSkillsItemSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetRequiredSkillsItemSourceExtractionVersionOneMax).regex(needRequirementSetRequiredSkillsItemSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One required or desired skill of the need. `taxonomy_code` is null for a skill that the platform taxonomy does not know: the server keeps the name as given, never maps it to a guessed code, and counts it as not covered in category recommendations.')).max(needRequirementSetRequiredSkillsMax).describe('Required skills; each has weight 2 in skill coverage. Only confirmed skills count.'),
"desired_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needRequirementSetDesiredSkillsItemNameMax).regex(needRequirementSetDesiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"taxonomy_code": zod.union([zod.string().min(1).max(needRequirementSetDesiredSkillsItemTaxonomyCodeOneMax).regex(needRequirementSetDesiredSkillsItemTaxonomyCodeOneRegExp).describe('Code of a skill in the platform skill taxonomy, for example `postgresql`. The server assigns it from the taxonomy; clients never send it and never derive it from the name.'),zod.null()]),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetDesiredSkillsItemSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetDesiredSkillsItemSourceExtractionVersionOneMax).regex(needRequirementSetDesiredSkillsItemSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One required or desired skill of the need. `taxonomy_code` is null for a skill that the platform taxonomy does not know: the server keeps the name as given, never maps it to a guessed code, and counts it as not covered in category recommendations.')).max(needRequirementSetDesiredSkillsMax).describe('Desired skills; each has weight 1 in skill coverage. Only confirmed skills count.'),
"tasks": zod.array(zod.object({
"text": zod.string().min(1).max(needRequirementSetTasksItemTextMax).regex(needRequirementSetTasksItemTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetTasksItemSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetTasksItemSourceExtractionVersionOneMax).regex(needRequirementSetTasksItemSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One work task of the team with its confirmation state and provenance.')).max(needRequirementSetTasksMax).describe('Work tasks of the team in the order given.'),
"domain": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.string().min(1).max(needRequirementSetDomainValueOneMax).regex(needRequirementSetDomainValueOneRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetDomainSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetDomainSourceOneExtractionVersionOneMax).regex(needRequirementSetDomainSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Business domain of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.'),
"work_formats": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(needRequirementSetWorkFormatsValueMax).nullable(),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetWorkFormatsSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetWorkFormatsSourceOneExtractionVersionOneMax).regex(needRequirementSetWorkFormatsSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Work formats that the employer offers, with their confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a known value lists one to three formats.'),
"location": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.string().min(1).max(needRequirementSetLocationValueOneMax).regex(needRequirementSetLocationValueOneRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetLocationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetLocationSourceOneExtractionVersionOneMax).regex(needRequirementSetLocationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Place of work with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. Readiness requires a confirmed place only when the confirmed work formats include `office` or `hybrid`.'),
"salary": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.object({
"salary_from": zod.int().min(needRequirementSetSalaryValueOneSalaryFromMin).max(needRequirementSetSalaryValueOneSalaryFromMax).multipleOf(needRequirementSetSalaryValueOneSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(needRequirementSetSalaryValueOneSalaryToMin).max(needRequirementSetSalaryValueOneSalaryToMax).multipleOf(needRequirementSetSalaryValueOneSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needRequirementSetSalarySourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needRequirementSetSalarySourceOneExtractionVersionOneMax).regex(needRequirementSetSalarySourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Salary range that the employer offers, with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. A text without a salary leaves it unknown; the server never substitutes zero, a market estimate, or a range from another need.')
}).describe('Requirements of one need version, each with its confirmation state and provenance. Read-only; requests change them through the fields of NeedCreate and NeedUpdate.')
export type NeedRequirementSet = zod.input<typeof NeedRequirementSet>;
export type NeedRequirementSetOutput = zod.output<typeof NeedRequirementSet>;
@@ -0,0 +1,43 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needSalaryValueOneSalaryFromMin = 1000;
export const needSalaryValueOneSalaryFromMax = 100000000;
export const needSalaryValueOneSalaryFromMultipleOf = 1000;
export const needSalaryValueOneSalaryToMin = 1000;
export const needSalaryValueOneSalaryToMax = 100000000;
export const needSalaryValueOneSalaryToMultipleOf = 1000;
export const needSalarySourceOneQuoteOneMax = 300;
export const needSalarySourceOneExtractionVersionOneMax = 64;
export const needSalarySourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedSalary = zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.object({
"salary_from": zod.int().min(needSalaryValueOneSalaryFromMin).max(needSalaryValueOneSalaryFromMax).multipleOf(needSalaryValueOneSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(needSalaryValueOneSalaryToMin).max(needSalaryValueOneSalaryToMax).multipleOf(needSalaryValueOneSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needSalarySourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needSalarySourceOneExtractionVersionOneMax).regex(needSalarySourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Salary range that the employer offers, with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`. A text without a salary leaves it unknown; the server never substitutes zero, a market estimate, or a range from another need.')
export type NeedSalary = zod.input<typeof NeedSalary>;
export type NeedSalaryOutput = zod.output<typeof NeedSalary>;
@@ -0,0 +1,30 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needSalaryInputValueSalaryFromMin = 1000;
export const needSalaryInputValueSalaryFromMax = 100000000;
export const needSalaryInputValueSalaryFromMultipleOf = 1000;
export const needSalaryInputValueSalaryToMin = 1000;
export const needSalaryInputValueSalaryToMax = 100000000;
export const needSalaryInputValueSalaryToMultipleOf = 1000;
export const NeedSalaryInput = zod.object({
"value": zod.object({
"salary_from": zod.int().min(needSalaryInputValueSalaryFromMin).max(needSalaryInputValueSalaryFromMax).multipleOf(needSalaryInputValueSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(needSalaryInputValueSalaryToMin).max(needSalaryInputValueSalaryToMax).multipleOf(needSalaryInputValueSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the salary range in a request; see NeedUpdate for the rules of `status` and SalaryRange for the rules of the range, whose pointers are under `/salary/value`.')
export type NeedSalaryInput = zod.input<typeof NeedSalaryInput>;
export type NeedSalaryInputOutput = zod.output<typeof NeedSalaryInput>;
@@ -0,0 +1,38 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needSkillNameMax = 100;
export const needSkillNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needSkillTaxonomyCodeOneMax = 64;
export const needSkillTaxonomyCodeOneRegExp = new RegExp('^[a-z0-9][a-z0-9_.+#-]*$');
export const needSkillSourceQuoteOneMax = 300;
export const needSkillSourceExtractionVersionOneMax = 64;
export const needSkillSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedSkill = zod.object({
"name": zod.string().min(1).max(needSkillNameMax).regex(needSkillNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"taxonomy_code": zod.union([zod.string().min(1).max(needSkillTaxonomyCodeOneMax).regex(needSkillTaxonomyCodeOneRegExp).describe('Code of a skill in the platform skill taxonomy, for example `postgresql`. The server assigns it from the taxonomy; clients never send it and never derive it from the name.'),zod.null()]),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needSkillSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needSkillSourceExtractionVersionOneMax).regex(needSkillSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One required or desired skill of the need. `taxonomy_code` is null for a skill that the platform taxonomy does not know: the server keeps the name as given, never maps it to a guessed code, and counts it as not covered in category recommendations.')
export type NeedSkill = zod.input<typeof NeedSkill>;
export type NeedSkillOutput = zod.output<typeof NeedSkill>;
@@ -0,0 +1,20 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needSkillInputNameMax = 100;
export const needSkillInputNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedSkillInput = zod.object({
"name": zod.string().min(1).max(needSkillInputNameMax).regex(needSkillInputNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')
export type NeedSkillInput = zod.input<typeof NeedSkillInput>;
export type NeedSkillInputOutput = zod.output<typeof NeedSkillInput>;
@@ -0,0 +1,32 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needSkillOverlapShareMin = 0;
export const needSkillOverlapShareMax = 1;
export const needSkillOverlapCoveredSkillsItemMax = 100;
export const needSkillOverlapCoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needSkillOverlapCoveredSkillsMax = 60;
export const needSkillOverlapUncoveredSkillsItemMax = 100;
export const needSkillOverlapUncoveredSkillsItemRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needSkillOverlapUncoveredSkillsMax = 60;
export const NeedSkillOverlap = zod.object({
"share": zod.number().min(needSkillOverlapShareMin).max(needSkillOverlapShareMax).describe('Weighted share from 0 to 1, rounded to two decimals.'),
"covered_skills": zod.array(zod.string().min(1).max(needSkillOverlapCoveredSkillsItemMax).regex(needSkillOverlapCoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needSkillOverlapCoveredSkillsMax).describe('Confirmed skills of the need that the category covers.'),
"uncovered_skills": zod.array(zod.string().min(1).max(needSkillOverlapUncoveredSkillsItemMax).regex(needSkillOverlapUncoveredSkillsItemRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')).max(needSkillOverlapUncoveredSkillsMax).describe('Confirmed skills of the need that the category does not cover, including skills without a taxonomy code.')
}).describe('Skill coverage of a category: the weighted share of the confirmed skills of the need that the category taxonomy covers, with weight 2 for a required and 1 for a desired skill.')
export type NeedSkillOverlap = zod.input<typeof NeedSkillOverlap>;
export type NeedSkillOverlapOutput = zod.output<typeof NeedSkillOverlap>;
@@ -0,0 +1,15 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedSourceQuoteMax = 300;
export const NeedSourceQuote = zod.string().min(1).max(NeedSourceQuoteMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.')
export type NeedSourceQuote = zod.input<typeof NeedSourceQuote>;
export type NeedSourceQuoteOutput = zod.output<typeof NeedSourceQuote>;
@@ -0,0 +1,15 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedSourceTextMax = 10000;
export const NeedSourceText = zod.string().min(1).max(NeedSourceTextMax).describe('Free description of the team\'s tasks as the employer wrote or pasted it. The server extracts proposed requirements from it; the text itself is never a requirement. It may contain line breaks. Plain text; clients show it as text, never as HTML. It describes the job and must not contain personal data of candidates. The server stores it as written: it may contain requirements that discriminate by a protected characteristic, and the extractor never turns such a requirement into a need field. Exclusions, the requirements that a candidate must not meet, are planned as a separate additive field with the Labor Code article 64 check (TASK-182).')
export type NeedSourceText = zod.input<typeof NeedSourceText>;
export type NeedSourceTextOutput = zod.output<typeof NeedSourceText>;
@@ -0,0 +1,29 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needSpecializationSourceOneQuoteOneMax = 300;
export const needSpecializationSourceOneExtractionVersionOneMax = 64;
export const needSpecializationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedSpecialization = zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needSpecializationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needSpecializationSourceOneExtractionVersionOneMax).regex(needSpecializationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target specialization of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.')
export type NeedSpecialization = zod.input<typeof NeedSpecialization>;
export type NeedSpecializationOutput = zod.output<typeof NeedSpecialization>;
@@ -0,0 +1,15 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedSpecializationInput = zod.object({
"value": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the specialization in a request; see NeedUpdate for the rules of `status`.')
export type NeedSpecializationInput = zod.input<typeof NeedSpecializationInput>;
export type NeedSpecializationInputOutput = zod.output<typeof NeedSpecializationInput>;
@@ -0,0 +1,71 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needSummaryTitleMax = 200;
export const needSummaryTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needSummarySpecializationSourceOneQuoteOneMax = 300;
export const needSummarySpecializationSourceOneExtractionVersionOneMax = 64;
export const needSummarySpecializationSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needSummaryGradeSourceOneQuoteOneMax = 300;
export const needSummaryGradeSourceOneExtractionVersionOneMax = 64;
export const needSummaryGradeSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const needSummaryReadinessMissingFieldsItemQuestionMax = 300;
export const needSummaryReadinessMissingFieldsMax = 9;
export const NeedSummary = zod.object({
"id": zod.uuid().describe('Identifier of the need.'),
"vacancy_id": zod.uuid().nullable().describe('Linked vacancy, or null.'),
"title": zod.string().min(1).max(needSummaryTitleMax).regex(needSummaryTitleRegExp).describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),
"specialization": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needSummarySpecializationSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needSummarySpecializationSourceOneExtractionVersionOneMax).regex(needSummarySpecializationSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target specialization of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`.'),
"grade": zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needSummaryGradeSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needSummaryGradeSourceOneExtractionVersionOneMax).regex(needSummaryGradeSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Target grade of the need with its confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a text that names no grade leaves the grade unknown instead of assuming one.'),
"readiness": zod.object({
"status": zod.enum(['complete', 'incomplete']).describe('`complete` when every critical field has a confirmed value, otherwise `incomplete`.'),
"missing_fields": zod.array(zod.object({
"field": zod.enum(['specialization', 'grade', 'required_skills', 'desired_skills', 'tasks', 'domain', 'work_formats', 'location', 'salary']).describe('Name of a need field, equal to its property name in NeedRequirementSet and in the request bodies. Adding a value is a contract change.'),
"reason": zod.enum(['unknown', 'unconfirmed']).describe('Why a critical field is missing: `unknown`, the field has no value, or `unconfirmed`, it has only an extracted value or, for required skills, only extracted items that wait for confirmation.'),
"question": zod.string().min(1).max(needSummaryReadinessMissingFieldsItemQuestionMax).describe('Specific Russian question about the missing value, for example which grade is needed. Plain text; the client shows it as text, never as HTML.')
}).describe('One critical field that has no confirmed value, with a specific question that the client shows next to the field.')).max(needSummaryReadinessMissingFieldsMax).describe('Critical fields without a confirmed value, each at most once, in the order of NeedFieldName. Empty exactly when `status` is `complete`.')
}).describe('Completeness of the critical fields, computed by the server for the current version. The critical fields are `specialization`, `grade`, `required_skills` (at least one confirmed skill), `work_formats`, `salary`, and `location` when the confirmed work formats include `office` or `hybrid`. An incomplete need is still a valid saved need; each later operation, such as search or an invitation, states which readiness it requires.'),
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),
"updated_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.')
}).describe('Need in a list: its identity, current version, target category fields, and readiness. Read the need for the requirements and the recommendations.')
export type NeedSummary = zod.input<typeof NeedSummary>;
export type NeedSummaryOutput = zod.output<typeof NeedSummary>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedSupplyBand = zod.enum(['fewer_than_5', 'from_5_to_29', '30_or_more']).describe('Number of available candidates of the category in the allowed detail: `fewer_than_5`, `from_5_to_29`, or `30_or_more`. Smaller groups are never counted exactly.')
export type NeedSupplyBand = zod.input<typeof NeedSupplyBand>;
export type NeedSupplyBandOutput = zod.output<typeof NeedSupplyBand>;
@@ -0,0 +1,33 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needTaskTextMax = 300;
export const needTaskTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needTaskSourceQuoteOneMax = 300;
export const needTaskSourceExtractionVersionOneMax = 64;
export const needTaskSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedTask = zod.object({
"text": zod.string().min(1).max(needTaskTextMax).regex(needTaskTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.'),
"source": zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needTaskSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needTaskSourceExtractionVersionOneMax).regex(needTaskSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
}).describe('One work task of the team with its confirmation state and provenance.')
export type NeedTask = zod.input<typeof NeedTask>;
export type NeedTaskOutput = zod.output<typeof NeedTask>;
@@ -0,0 +1,20 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needTaskInputTextMax = 300;
export const needTaskInputTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedTaskInput = zod.object({
"text": zod.string().min(1).max(needTaskInputTextMax).regex(needTaskInputTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One task of the list in a request. A text equal to a task of the current version refers to that task and keeps its origin and quote; any other text is a new manual task. `status` and repeated texts follow the rules of NeedSkillInput.')
export type NeedTaskInput = zod.input<typeof NeedTaskInput>;
export type NeedTaskInputOutput = zod.output<typeof NeedTaskInput>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedTaskTextMax = 300;
export const NeedTaskTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedTaskText = zod.string().min(1).max(NeedTaskTextMax).regex(NeedTaskTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
export type NeedTaskText = zod.input<typeof NeedTaskText>;
export type NeedTaskTextOutput = zod.output<typeof NeedTaskText>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedTitleMax = 200;
export const NeedTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const NeedTitle = zod.string().min(1).max(NeedTitleMax).regex(NeedTitleRegExp).describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
export type NeedTitle = zod.input<typeof NeedTitle>;
export type NeedTitleOutput = zod.output<typeof NeedTitle>;
@@ -0,0 +1,103 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needUpdateTitleMax = 200;
export const needUpdateTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needUpdateSourceTextOneMax = 10000;
export const needUpdateRequiredSkillsItemNameMax = 100;
export const needUpdateRequiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needUpdateRequiredSkillsMax = 30;
export const needUpdateDesiredSkillsItemNameMax = 100;
export const needUpdateDesiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needUpdateDesiredSkillsMax = 30;
export const needUpdateTasksItemTextMax = 300;
export const needUpdateTasksItemTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needUpdateTasksMax = 20;
export const needUpdateDomainOneValueMax = 100;
export const needUpdateDomainOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needUpdateWorkFormatsOneValueMax = 3;
export const needUpdateLocationOneValueMax = 100;
export const needUpdateLocationOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const needUpdateSalaryOneValueSalaryFromMin = 1000;
export const needUpdateSalaryOneValueSalaryFromMax = 100000000;
export const needUpdateSalaryOneValueSalaryFromMultipleOf = 1000;
export const needUpdateSalaryOneValueSalaryToMin = 1000;
export const needUpdateSalaryOneValueSalaryToMax = 100000000;
export const needUpdateSalaryOneValueSalaryToMultipleOf = 1000;
export const NeedUpdate = zod.object({
"expected_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),
"title": zod.string().min(1).max(needUpdateTitleMax).regex(needUpdateTitleRegExp).exactOptional().describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"vacancy_id": zod.uuid().nullish().describe('Vacancy of the same organization to link, or null to unlink.'),
"source_text": zod.union([zod.string().min(1).max(needUpdateSourceTextOneMax).describe('Free description of the team\'s tasks as the employer wrote or pasted it. The server extracts proposed requirements from it; the text itself is never a requirement. It may contain line breaks. Plain text; clients show it as text, never as HTML. It describes the job and must not contain personal data of candidates. The server stores it as written: it may contain requirements that discriminate by a protected characteristic, and the extractor never turns such a requirement into a need field. Exclusions, the requirements that a candidate must not meet, are planned as a separate additive field with the Labor Code article 64 check (TASK-182).'),zod.null()]).exactOptional(),
"specialization": zod.union([zod.object({
"value": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the specialization in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"grade": zod.union([zod.object({
"value": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the grade in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"required_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needUpdateRequiredSkillsItemNameMax).regex(needUpdateRequiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(needUpdateRequiredSkillsMax).exactOptional(),
"desired_skills": zod.array(zod.object({
"name": zod.string().min(1).max(needUpdateDesiredSkillsItemNameMax).regex(needUpdateDesiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(needUpdateDesiredSkillsMax).exactOptional(),
"tasks": zod.array(zod.object({
"text": zod.string().min(1).max(needUpdateTasksItemTextMax).regex(needUpdateTasksItemTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One task of the list in a request. A text equal to a task of the current version refers to that task and keeps its origin and quote; any other text is a new manual task. `status` and repeated texts follow the rules of NeedSkillInput.')).max(needUpdateTasksMax).exactOptional(),
"domain": zod.union([zod.object({
"value": zod.string().min(1).max(needUpdateDomainOneValueMax).regex(needUpdateDomainOneValueRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the domain in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"work_formats": zod.union([zod.object({
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(needUpdateWorkFormatsOneValueMax),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the work formats in a request; see NeedUpdate for the rules of `status`. Formats are compared as a set.'),zod.null()]).exactOptional(),
"location": zod.union([zod.object({
"value": zod.string().min(1).max(needUpdateLocationOneValueMax).regex(needUpdateLocationOneValueRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the place of work in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"salary": zod.union([zod.object({
"value": zod.object({
"salary_from": zod.int().min(needUpdateSalaryOneValueSalaryFromMin).max(needUpdateSalaryOneValueSalaryFromMax).multipleOf(needUpdateSalaryOneValueSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(needUpdateSalaryOneValueSalaryToMin).max(needUpdateSalaryOneValueSalaryToMax).multipleOf(needUpdateSalaryOneValueSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the salary range in a request; see NeedUpdate for the rules of `status` and SalaryRange for the rules of the range, whose pointers are under `/salary/value`.'),zod.null()]).exactOptional()
}).describe('Change of a need over the version the client read. Each field present in the body replaces that field as a whole; an absent field stays unchanged. Nested objects and lists are not merged: a field decision and each list are replaced entirely, and a stored item missing from a sent list is deleted. A nullable field sent as null becomes unknown, or unlinked for `vacancy_id`; a skill or task list sent empty deletes every item; a list sent as null fails validation. A field decision `{value, status}` and a list item follow the same rules: `confirmed` with the stored value confirms it and keeps its origin and quote, and `confirmed` with another value sets a confirmed manual value; `extracted` keeps a stored suggestion unconfirmed and is allowed only with exactly the stored suggested value, otherwise it answers 400 with the pointer of that `status`, such as `/grade/status` or `/required_skills/0/status`. A client that sends back an unchanged form therefore confirms nothing by accident: it sends each suggestion with `extracted`, or leaves the field out. Sending a different `source_text` extracts again: new suggestions replace only the `extracted` values and items of fields not named in this body; confirmed values are never overwritten, a suggested skill whose name is already in either skill list is skipped, and a suggestion that a member deleted is not proposed again for this need. Unknown fields are rejected, so a request cannot set membership, a role, a provenance, readiness, a recommendation or its score, or a candidate\'s salary minimum.')
export type NeedUpdate = zod.input<typeof NeedUpdate>;
export type NeedUpdateOutput = zod.output<typeof NeedUpdate>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedValueOrigin = zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.')
export type NeedValueOrigin = zod.input<typeof NeedValueOrigin>;
export type NeedValueOriginOutput = zod.output<typeof NeedValueOrigin>;
@@ -0,0 +1,25 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needValueSourceQuoteOneMax = 300;
export const needValueSourceExtractionVersionOneMax = 64;
export const needValueSourceExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedValueSource = zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needValueSourceQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needValueSourceExtractionVersionOneMax).regex(needValueSourceExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.')
export type NeedValueSource = zod.input<typeof NeedValueSource>;
export type NeedValueSourceOutput = zod.output<typeof NeedValueSource>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedValueStatus = zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.')
export type NeedValueStatus = zod.input<typeof NeedValueStatus>;
export type NeedValueStatusOutput = zod.output<typeof NeedValueStatus>;
@@ -0,0 +1,14 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedVersion = zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.')
export type NeedVersion = zod.input<typeof NeedVersion>;
export type NeedVersionOutput = zod.output<typeof NeedVersion>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NeedVersionLabelMax = 64;
export const NeedVersionLabelRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedVersionLabel = zod.string().min(1).max(NeedVersionLabelMax).regex(NeedVersionLabelRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.')
export type NeedVersionLabel = zod.input<typeof NeedVersionLabel>;
export type NeedVersionLabelOutput = zod.output<typeof NeedVersionLabel>;
@@ -0,0 +1,31 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needWorkFormatsValueMax = 3;
export const needWorkFormatsSourceOneQuoteOneMax = 300;
export const needWorkFormatsSourceOneExtractionVersionOneMax = 64;
export const needWorkFormatsSourceOneExtractionVersionOneRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const NeedWorkFormats = zod.object({
"status": zod.enum(['confirmed', 'extracted', 'unknown']).describe('Confirmation state of one need field.\n\n- confirmed: a member of the organization entered the value or confirmed it. Only confirmed values feed readiness, category recommendations, search, and invitations.\n- extracted: the server proposed the value from the need text or an import, and nobody has confirmed it yet. It is a suggestion: it never feeds search or recommendations and never counts as an answer in readiness.\n- unknown: the field has no value. `value` and `source` are null. The server never fills an unknown field with a default or a guess, such as a Senior grade, the remote format, or a zero salary.'),
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(needWorkFormatsValueMax).nullable(),
"source": zod.union([zod.object({
"origin": zod.enum(['manual', 'extracted_from_text', 'imported']).describe('Where the value of a field or item came from. The server sets it; a request never sends it.\n\n- manual: a member of the organization typed the value in the form. `quote`, `extraction_version`, and `extracted_in_version` are null.\n- extracted_from_text: the server extracted the value from `source_text`, with the deterministic rules and dictionary or, planned, with the ML service. `extraction_version` names the extractor version.\n- imported: planned; the value was copied from a linked vacancy or an import. No MVP operation produces it.\n\nConfirming an extracted value keeps its origin and quote; changing the value makes it `manual`. Adding a value is a contract change.'),
"quote": zod.union([zod.string().min(1).max(needWorkFormatsSourceOneQuoteOneMax).describe('Exact excerpt of the `source_text` that the value was extracted from, so a reviewer can check it. It may contain line breaks. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Excerpt of the need text that supports the value, or null for a manual value and for an extracted value that the extractor did not tie to one excerpt.'),
"extracted_in_version": zod.union([zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),zod.null()]).describe('Need version whose `source_text` the value was extracted from and the quote is an excerpt of, or null for a manual value. A confirmed value keeps it after the text changes, so its quote may be absent from the current `source_text`.'),
"extraction_version": zod.union([zod.string().min(1).max(needWorkFormatsSourceOneExtractionVersionOneMax).regex(needWorkFormatsSourceOneExtractionVersionOneRegExp).describe('Opaque identifier of a published extractor or algorithm version, for example `need-rules.2026-10.1`. Clients show it as text and never parse it.'),zod.null()]).describe('Extractor version for an extracted or imported value, or null for a manual value.')
}).describe('Provenance of a value: its origin, the quote it was extracted from, the need version whose text the quote belongs to, and the extractor version. Read-only; the server derives it and a request cannot set it.'),zod.null()])
}).describe('Work formats that the employer offers, with their confirmation state and provenance. `value` and `source` are null exactly when `status` is `unknown`; a known value lists one to three formats.')
export type NeedWorkFormats = zod.input<typeof NeedWorkFormats>;
export type NeedWorkFormatsOutput = zod.output<typeof NeedWorkFormats>;
@@ -0,0 +1,18 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const needWorkFormatsInputValueMax = 3;
export const NeedWorkFormatsInput = zod.object({
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(needWorkFormatsInputValueMax),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the work formats in a request; see NeedUpdate for the rules of `status`. Formats are compared as a set.')
export type NeedWorkFormatsInput = zod.input<typeof NeedWorkFormatsInput>;
export type NeedWorkFormatsInputOutput = zod.output<typeof NeedWorkFormatsInput>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const RubAmountMin = 1000;
export const RubAmountMax = 100000000;
export const RubAmountMultipleOf = 1000;
export const RubAmount = zod.int().min(RubAmountMin).max(RubAmountMax).multipleOf(RubAmountMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.')
export type RubAmount = zod.input<typeof RubAmount>;
export type RubAmountOutput = zod.output<typeof RubAmount>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const SalaryPeriod = zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.')
export type SalaryPeriod = zod.input<typeof SalaryPeriod>;
export type SalaryPeriodOutput = zod.output<typeof SalaryPeriod>;
@@ -0,0 +1,27 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const salaryRangeSalaryFromMin = 1000;
export const salaryRangeSalaryFromMax = 100000000;
export const salaryRangeSalaryFromMultipleOf = 1000;
export const salaryRangeSalaryToMin = 1000;
export const salaryRangeSalaryToMax = 100000000;
export const salaryRangeSalaryToMultipleOf = 1000;
export const SalaryRange = zod.object({
"salary_from": zod.int().min(salaryRangeSalaryFromMin).max(salaryRangeSalaryFromMax).multipleOf(salaryRangeSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(salaryRangeSalaryToMin).max(salaryRangeSalaryToMax).multipleOf(salaryRangeSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.')
export type SalaryRange = zod.input<typeof SalaryRange>;
export type SalaryRangeOutput = zod.output<typeof SalaryRange>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const SalaryTaxBasis = zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
export type SalaryTaxBasis = zod.input<typeof SalaryTaxBasis>;
export type SalaryTaxBasisOutput = zod.output<typeof SalaryTaxBasis>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const SkillNameMax = 100;
export const SkillNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const SkillName = zod.string().min(1).max(SkillNameMax).regex(SkillNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.')
export type SkillName = zod.input<typeof SkillName>;
export type SkillNameOutput = zod.output<typeof SkillName>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const SkillTaxonomyCodeMax = 64;
export const SkillTaxonomyCodeRegExp = new RegExp('^[a-z0-9][a-z0-9_.+#-]*$');
export const SkillTaxonomyCode = zod.string().min(1).max(SkillTaxonomyCodeMax).regex(SkillTaxonomyCodeRegExp).describe('Code of a skill in the platform skill taxonomy, for example `postgresql`. The server assigns it from the taxonomy; clients never send it and never derive it from the name.')
export type SkillTaxonomyCode = zod.input<typeof SkillTaxonomyCode>;
export type SkillTaxonomyCodeOutput = zod.output<typeof SkillTaxonomyCode>;
@@ -0,0 +1,103 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const updateOrganizationNeedBodyTitleMax = 200;
export const updateOrganizationNeedBodyTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationNeedBodySourceTextOneMax = 10000;
export const updateOrganizationNeedBodyRequiredSkillsItemNameMax = 100;
export const updateOrganizationNeedBodyRequiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationNeedBodyRequiredSkillsMax = 30;
export const updateOrganizationNeedBodyDesiredSkillsItemNameMax = 100;
export const updateOrganizationNeedBodyDesiredSkillsItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationNeedBodyDesiredSkillsMax = 30;
export const updateOrganizationNeedBodyTasksItemTextMax = 300;
export const updateOrganizationNeedBodyTasksItemTextRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationNeedBodyTasksMax = 20;
export const updateOrganizationNeedBodyDomainOneValueMax = 100;
export const updateOrganizationNeedBodyDomainOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationNeedBodyWorkFormatsOneValueMax = 3;
export const updateOrganizationNeedBodyLocationOneValueMax = 100;
export const updateOrganizationNeedBodyLocationOneValueRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationNeedBodySalaryOneValueSalaryFromMin = 1000;
export const updateOrganizationNeedBodySalaryOneValueSalaryFromMax = 100000000;
export const updateOrganizationNeedBodySalaryOneValueSalaryFromMultipleOf = 1000;
export const updateOrganizationNeedBodySalaryOneValueSalaryToMin = 1000;
export const updateOrganizationNeedBodySalaryOneValueSalaryToMax = 100000000;
export const updateOrganizationNeedBodySalaryOneValueSalaryToMultipleOf = 1000;
export const UpdateOrganizationNeedBody = zod.object({
"expected_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'),
"title": zod.string().min(1).max(updateOrganizationNeedBodyTitleMax).regex(updateOrganizationNeedBodyTitleRegExp).exactOptional().describe('Short name of the need inside the organization, for example "Backend for the payments team". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"vacancy_id": zod.uuid().nullish().describe('Vacancy of the same organization to link, or null to unlink.'),
"source_text": zod.union([zod.string().min(1).max(updateOrganizationNeedBodySourceTextOneMax).describe('Free description of the team\'s tasks as the employer wrote or pasted it. The server extracts proposed requirements from it; the text itself is never a requirement. It may contain line breaks. Plain text; clients show it as text, never as HTML. It describes the job and must not contain personal data of candidates. The server stores it as written: it may contain requirements that discriminate by a protected characteristic, and the extractor never turns such a requirement into a need field. Exclusions, the requirements that a candidate must not meet, are planned as a separate additive field with the Labor Code article 64 check (TASK-182).'),zod.null()]).exactOptional(),
"specialization": zod.union([zod.object({
"value": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the specialization in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"grade": zod.union([zod.object({
"value": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the grade in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"required_skills": zod.array(zod.object({
"name": zod.string().min(1).max(updateOrganizationNeedBodyRequiredSkillsItemNameMax).regex(updateOrganizationNeedBodyRequiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(updateOrganizationNeedBodyRequiredSkillsMax).exactOptional(),
"desired_skills": zod.array(zod.object({
"name": zod.string().min(1).max(updateOrganizationNeedBodyDesiredSkillsItemNameMax).regex(updateOrganizationNeedBodyDesiredSkillsItemNameRegExp).describe('Name of a skill or technology as the employer gave it, for example Go, PostgreSQL, or Temporal. It has no leading or trailing whitespace and no line breaks. The server compares names without regard to letter case. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One skill of a list in a request. A name that equals, without regard to letter case, a skill of the current version in either skill list refers to that skill and keeps its origin, quote, and taxonomy code; this is how an extracted skill is confirmed or moved between the required and desired lists. Any other name is a new manual skill. `status` follows the rules of NeedUpdate: `extracted` for a name that is not a stored suggestion answers 400 validation_failed with the pointer of that `status`, for example `/required_skills/2/status`. A name repeated within or across the two skill lists answers 400 with the pointer of the later `name`.')).max(updateOrganizationNeedBodyDesiredSkillsMax).exactOptional(),
"tasks": zod.array(zod.object({
"text": zod.string().min(1).max(updateOrganizationNeedBodyTasksItemTextMax).regex(updateOrganizationNeedBodyTasksItemTextRegExp).describe('One work task of the team, for example "Move the payout service to an event model". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('One task of the list in a request. A text equal to a task of the current version refers to that task and keeps its origin and quote; any other text is a new manual task. `status` and repeated texts follow the rules of NeedSkillInput.')).max(updateOrganizationNeedBodyTasksMax).exactOptional(),
"domain": zod.union([zod.object({
"value": zod.string().min(1).max(updateOrganizationNeedBodyDomainOneValueMax).regex(updateOrganizationNeedBodyDomainOneValueRegExp).describe('Business domain of the work, for example payments or logistics, as free text. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the domain in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"work_formats": zod.union([zod.object({
"value": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(updateOrganizationNeedBodyWorkFormatsOneValueMax),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the work formats in a request; see NeedUpdate for the rules of `status`. Formats are compared as a set.'),zod.null()]).exactOptional(),
"location": zod.union([zod.object({
"value": zod.string().min(1).max(updateOrganizationNeedBodyLocationOneValueMax).regex(updateOrganizationNeedBodyLocationOneValueRegExp).describe('Place of work for the office or hybrid format, for example a city, as free text. It describes the employer\'s office, never a candidate\'s address. Plain text without line breaks; clients show it as text, never as HTML.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the place of work in a request; see NeedUpdate for the rules of `status`.'),zod.null()]).exactOptional(),
"salary": zod.union([zod.object({
"value": zod.object({
"salary_from": zod.int().min(updateOrganizationNeedBodySalaryOneValueSalaryFromMin).max(updateOrganizationNeedBodySalaryOneValueSalaryFromMax).multipleOf(updateOrganizationNeedBodySalaryOneValueSalaryFromMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"salary_to": zod.int().min(updateOrganizationNeedBodySalaryOneValueSalaryToMin).max(updateOrganizationNeedBodySalaryOneValueSalaryToMax).multipleOf(updateOrganizationNeedBodySalaryOneValueSalaryToMultipleOf).describe('Amount of money in whole rubles. A salary bound is positive and a multiple of 1000, the step that PRD FR13 sets for the bounds of a salary range and for the bids of the sealed final.'),
"currency": zod.enum(['RUB']).describe('ISO 4217 currency code. The MVP accepts only RUB; adding a value is a contract change.'),
"period": zod.enum(['month']).describe('Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.'),
"tax_basis": zod.enum(['net', 'gross']).describe('Tax basis of a salary amount: `net`, the amount paid out after personal income tax, or `gross`, the amount before it. The basis is always explicit; amounts in different bases are never compared directly.')
}).describe('Salary range `[A; B]` in whole rubles with its base: the currency, the pay period, and the tax basis (PRD FR13). The schema requires every field, bounds that are positive multiples of 1000, and the known currency, period, and basis. The server checks the cross-field rules in integer arithmetic: `salary_from < salary_to`, and a width `(B - A) / ((A + B) / 2)` from 10% to 40% inclusive, that is `20 * (B - A) >= A + B` and `5 * (B - A) <= A + B`. A violation answers 400 validation_failed with the pointer of `salary_to` in the request, for example `/salary/value/salary_to`. For example, `[95000; 105000]` has a width of exactly 10% and `[80000; 120000]` exactly 40%; both are accepted. The rules are the same for a need and an invitation.'),
"status": zod.enum(['confirmed', 'extracted']).describe('Confirmation state of a list item, and the decision that a request sends for a field or an item: `confirmed` or `extracted`, with the meaning of NeedValueStatus. A request sends `confirmed` to confirm a suggestion or to set a manual value, and `extracted` only to keep a stored suggestion unconfirmed with exactly its stored value. An item is never `unknown`; a list with no confirmed item is what readiness reports as missing.')
}).describe('Decision about the salary range in a request; see NeedUpdate for the rules of `status` and SalaryRange for the rules of the range, whose pointers are under `/salary/value`.'),zod.null()]).exactOptional()
}).describe('Change of a need over the version the client read. Each field present in the body replaces that field as a whole; an absent field stays unchanged. Nested objects and lists are not merged: a field decision and each list are replaced entirely, and a stored item missing from a sent list is deleted. A nullable field sent as null becomes unknown, or unlinked for `vacancy_id`; a skill or task list sent empty deletes every item; a list sent as null fails validation. A field decision `{value, status}` and a list item follow the same rules: `confirmed` with the stored value confirms it and keeps its origin and quote, and `confirmed` with another value sets a confirmed manual value; `extracted` keeps a stored suggestion unconfirmed and is allowed only with exactly the stored suggested value, otherwise it answers 400 with the pointer of that `status`, such as `/grade/status` or `/required_skills/0/status`. A client that sends back an unchanged form therefore confirms nothing by accident: it sends each suggestion with `extracted`, or leaves the field out. Sending a different `source_text` extracts again: new suggestions replace only the `extracted` values and items of fields not named in this body; confirmed values are never overwritten, a suggested skill whose name is already in either skill list is skipped, and a suggestion that a member deleted is not proposed again for this need. Unknown fields are rejected, so a request cannot set membership, a role, a provenance, readiness, a recommendation or its score, or a candidate\'s salary minimum.')
export type UpdateOrganizationNeedBody = zod.input<typeof UpdateOrganizationNeedBody>;
export type UpdateOrganizationNeedBodyOutput = zod.output<typeof UpdateOrganizationNeedBody>;