adorsys / adorsys/status-list-server
Align OpenAPI status contract & dual string/integer deserialization
- Linguagem predominante
- Rust
- Estrelas
- 22
- Forks
- 5
- Merge médio
- 2d 6h
- PRs com merge (30d)
- 47
Descrição
## Objective
Resolve the contract mismatch between `docs/openapi.yaml` and `src/server/handlers/status_list/utils/request.rs` by supporting both string and integer status representations in serde and accurately documenting them.
## Context
In `docs/openapi.yaml`, `StatusValue` is documented as a string enum (`"VALID"`, `"INVALID"`, `"SUSPENDED"`). However, the serde deserializer in `src/server/handlers/status_list/utils/request.rs` only accepts numeric integers (`0`, `1`, `2`, `>=256`). When API clients generated from the OpenAPI specification send the documented string values (e.g. `{"index": 0, "status": "VALID"}`), the server rejects them with `HTTP 422 Unprocessable Entity`.
## Deliverables
- [ ] Update `Deserialize` for `Status` in `src/server/handlers/status_list/utils/request.rs` to accept:
- Numeric integers: `0` (VALID), `1` (INVALID), `2` (SUSPENDED), and `>=256` (ApplicationSpecific).
- String names (case-insensitive): `"VALID"` / `"valid"`, `"INVALID"` / `"invalid"`, `"SUSPENDED"` / `"suspended"`, and stringified integers (e.g. `"0"`).
- [ ] Update `docs/openapi.yaml` to document both formats using `oneOf` or a unified schema so client generators generate correct models.
- [ ] Add unit tests verifying successful deserialization of both string enum values and numeric values, and rejection of reserved integers (3..=255) and invalid strings.
## Acceptance Criteria
- [ ] `{"index": 0, "status": "VALID"}` and `{"index": 0, "status": 0}` are both accepted and deserialize to `Status::VALID`.
- [ ] OpenAPI specification matches server acceptance behavior.
- [ ] Standard OpenAPI-generated SDKs can publish and update status lists without deserialization errors.
## References
- `docs/openapi.yaml` (lines 560–565)
- `src/server/handlers/status_list/utils/request.rs` (lines 23–38)
- Arc review: `arc-review/finalReview/application-functional-bugs/README.md` (PoC 1)
Guia de contribuição
Direção de pesquisa
Start in `src/server/handlers/status_list/utils/request.rs` (around lines 23–38) where `Status` deserialization is implemented, then inspect `docs/openapi.yaml` lines 560–565 for the current `StatusValue` schema. Update both so string names (case-insensitive and stringified integers) and numeric values `0/1/2/>=256` are accepted consistently. Add/extend unit tests for valid string/numeric statuses and invalid values (`3..=255`, bad strings), then run the relevant status-list serde tests with `cargo test`; done when both request formats deserialize correctly and the OpenAPI contract reflects that behavior.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust
- Domínio
- api, backend, documentation
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Ativa
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 74/100