feat(api): add specialization catalog and candidate questionnaire contract
This commit is contained in:
1 parent
c338c0c188
commit
faeeb5f157
64 files changed
+8339
-47
No files matched your search
@@ -0,0 +1,84 @@
|
||||
get:
|
||||
operationId: GetMyQuestionnaire
|
||||
summary: Read the questionnaire of the current candidate.
|
||||
description: |-
|
||||
Requires the session cookie of a candidate account. The candidate comes from the session, never from a request parameter. A candidate who has not saved the questionnaire yet gets 200 with version 0 and no specializations rather than 404, so the client reads the version for the first save in the same way as for later ones and a missing questionnaire is not an error state.
|
||||
|
||||
The response never contains a confirmed grade or a category; those come only from assessment results. A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account answers 403 forbidden.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
tags:
|
||||
- candidate
|
||||
responses:
|
||||
"200":
|
||||
description: The questionnaire of the current candidate.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers.yml#/CacheControlNoStore
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/CandidateQuestionnaire
|
||||
examples:
|
||||
new_candidate:
|
||||
$ref: ../components/examples.yml#/NewCandidateQuestionnaire
|
||||
backend_go_and_network_engineer:
|
||||
$ref: ../components/examples.yml#/BackendGoAndNetworkEngineerQuestionnaire
|
||||
"401":
|
||||
$ref: ../components/responses.yml#/Unauthenticated
|
||||
"403":
|
||||
$ref: ../components/responses.yml#/Forbidden
|
||||
default:
|
||||
$ref: ../components/responses.yml#/Problem
|
||||
put:
|
||||
operationId: SaveMyQuestionnaire
|
||||
summary: Replace the questionnaire of the current candidate.
|
||||
description: |-
|
||||
Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The body is the complete new state: one or two specializations, each with a self-assessed grade, task languages, stack tags, and stated experience or null, and the working context. It replaces the stored questionnaire as a whole.
|
||||
|
||||
Self-assessment is a claim. It influences where the assessment starts and which grade the assessment step offers first, but it adds no points and never writes a confirmed grade or a category: a self-assessed `senior`, or the word "Senior" in a stack tag, never assigns the Senior category. A real profile stays invisible to employers until an assessment confirms a category. Choosing a specialization whose test is `in_development` is allowed; no assessment starts for it until its bank is published. Removing a specialization from the questionnaire does not change assessment results.
|
||||
|
||||
Optimistic concurrency uses `expected_version` in the body: the client sends the `version` it read, 0 for the first save. If it is not the current version, the server answers 412 version_conflict and changes nothing; the client reads the questionnaire again. The version travels in the body rather than in If-Match because the generated client cannot read the ETag response header yet. The status and code are the same as for a failed If-Match, since the client action is the same.
|
||||
|
||||
The operation needs no Idempotency-Key: it replaces the whole state and is idempotent. A body whose specializations and working context equal the stored ones changes nothing, keeps the version, and answers 200 with the current questionnaire even when `expected_version` is older, so a retry after a lost response of a successful save succeeds instead of failing with 412.
|
||||
|
||||
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for an employer), domain rules (400), then the version (412). The schema rejects more than two specializations, an unknown grade, specialization, or task language, and unknown fields. The server also rejects a repeated specialization and a task language that the specialization's published bank does not offer, with 400 validation_failed and pointers to the items, for example `/specializations/1/specialization` or `/specializations/0/task_languages/0`.
|
||||
|
||||
A successful save on the onboarding step candidate_questionnaire advances the account to candidate_assessment (planned).
|
||||
security:
|
||||
- sessionCookie: []
|
||||
sessionCsrf: []
|
||||
tags:
|
||||
- candidate
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/CandidateQuestionnaireUpdate
|
||||
examples:
|
||||
backend_go_and_network_engineer:
|
||||
$ref: ../components/examples.yml#/BackendGoAndNetworkEngineerQuestionnaireUpdate
|
||||
responses:
|
||||
"200":
|
||||
description: The saved questionnaire with its new version.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers.yml#/CacheControlNoStore
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/CandidateQuestionnaire
|
||||
examples:
|
||||
backend_go_and_network_engineer:
|
||||
$ref: ../components/examples.yml#/BackendGoAndNetworkEngineerQuestionnaire
|
||||
"400":
|
||||
$ref: ../components/responses.yml#/QuestionnaireValidationFailed
|
||||
"401":
|
||||
$ref: ../components/responses.yml#/Unauthenticated
|
||||
"403":
|
||||
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
|
||||
"412":
|
||||
$ref: ../components/responses.yml#/QuestionnaireVersionConflict
|
||||
default:
|
||||
$ref: ../components/responses.yml#/Problem
|
||||
@@ -0,0 +1,24 @@
|
||||
get:
|
||||
operationId: GetSpecializationCatalog
|
||||
summary: Read the catalog of directions, specializations, and grades.
|
||||
description: |-
|
||||
Public operation without a session. Returns the directions with their specializations, the assessment availability of each specialization, and the grade scale. The candidate picks specializations and self-assessed grades from this catalog for the questionnaire, and the client joins the codes stored in the questionnaire with the titles here.
|
||||
|
||||
The catalog is public because it is the same for every caller and contains no personal data: the product shows it before registration, and a public read lets intermediaries and the browser cache it. It reveals nothing beyond what the landing pages already show.
|
||||
|
||||
A category is a specialization together with a confirmed grade. Task languages and the stack are attributes of a chosen specialization and never appear as categories. `test_availability` is derived from the published task banks at the time of the request, so it changes when a bank is published, without a contract change: the MVP opens an assessment only for a category with a published bank, and every other specialization is marked `in_development`. Presence in the catalog never means that its test is ready.
|
||||
security: []
|
||||
tags:
|
||||
- catalog
|
||||
responses:
|
||||
"200":
|
||||
description: The catalog.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/SpecializationCatalog
|
||||
examples:
|
||||
mvp:
|
||||
$ref: ../components/examples.yml#/SpecializationCatalog
|
||||
default:
|
||||
$ref: ../components/responses.yml#/Problem
|
||||
Reference in new issue
Block a user