Describe enc_key as a single string instead of a oneOf of two strings #84

Merged
vitalif merged 1 commits from epicstyt/vitastor:fix-openapi-enc-key into master 2026-09-02 19:39:05 +03:00
Contributor

Description

The trouble is that both branches are strings, while discriminator — the only mechanism OpenAPI has for telling oneOf branches apart — requires the value to be an object. Generators have nothing to work with, and not one of them warns:

Generator Result today
ogen (Go) refuses to generate the spec
oapi-codegen (Go) union of raw JSON, the caller tries one branch, then the other
openapi-generator: java, go, typescript one branch silently dropped, enum and pattern lost with it
openapi-generator: rust enum { String(String), String(String) }, does not compile (E0428)
openapi-generator: csharp references a type it never generated, does not compile (CS0246)
openapi-generator: python both branches become plain str, so every value matches both and is rejected at runtime as "Multiple matches found" — "" and random included. The field cannot be used at all.
swagger-codegen v3 empty marker interface

Contributor Name

Stepan Rabotkin

CLA

### Description The trouble is that both branches are strings, while `discriminator` — the only mechanism OpenAPI has for telling `oneOf` branches apart — requires the value to be an object. Generators have nothing to work with, and not one of them warns: | Generator | Result today | | --- | --- | | ogen (Go) | refuses to generate the spec | | oapi-codegen (Go) | union of raw JSON, the caller tries one branch, then the other | | openapi-generator: java, go, typescript | one branch silently dropped, `enum` and `pattern` lost with it | | openapi-generator: rust | `enum { String(String), String(String) }`, does not compile (E0428) | | openapi-generator: csharp | references a type it never generated, does not compile (CS0246) | | openapi-generator: python | both branches become plain `str`, so every value matches both and is rejected at runtime as "Multiple matches found" — `""` and `random` included. The field cannot be used at all. | | swagger-codegen v3 | empty marker interface | ### Contributor Name Stepan Rabotkin ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
epicstyt added 1 commit 2026-09-01 22:43:27 +03:00
fix(openapi): fold the enc_key oneOf into a single string
Some checks failed
Test / test_enospc_imm (push) Has been cancelled
Test / test_enospc_imm_xor (push) Has been cancelled
Test / test_old_enospc (push) Has been cancelled
Test / test_old_enospc_xor (push) Has been cancelled
Test / test_old_enospc_imm (push) Has been cancelled
Test / test_old_enospc_imm_xor (push) Has been cancelled
Test / test_scrub (push) Has been cancelled
Test / test_scrub_zero_osd_2 (push) Has been cancelled
Test / test_scrub_xor (push) Has been cancelled
Test / test_scrub_pg_size_3 (push) Has been cancelled
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Has been cancelled
Test / test_scrub_ec (push) Has been cancelled
Test / test_old_scrub (push) Has been cancelled
Test / test_old_scrub_zero_osd_2 (push) Has been cancelled
Test / test_old_scrub_xor (push) Has been cancelled
Test / test_old_scrub_pg_size_3 (push) Has been cancelled
Test / test_old_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Has been cancelled
Test / test_old_scrub_ec (push) Has been cancelled
Test / test_old_partwr_csum (push) Has been cancelled
Test / test_heal_old_csum_32k_dmj (push) Has been cancelled
Test / test_heal_old_csum_32k_dj (push) Has been cancelled
Test / test_heal_old_csum_32k (push) Has been cancelled
Test / test_heal_old_csum_4k_dmj (push) Has been cancelled
Test / test_heal_old_csum_4k_dj (push) Has been cancelled
Test / test_heal_old_csum_4k (push) Has been cancelled
Test / test_nfs (push) Has been cancelled
Test / test_nfs_unaligned_append (push) Has been cancelled
Test / test_nfs_long_readdir (push) Has been cancelled
Test / test_write_encrypted (push) Has been cancelled
Test / test_write_encrypted_ec (push) Has been cancelled
2a68ad2a05
The two string branches of enc_key carry no discriminator, so a decoder
cannot tell them apart. They do not overlap, so each union becomes one
string whose pattern accepts the same values.

Signed-off-by: Stepan Rabotkin <epicstyt@gmail.com>
vitalif approved these changes 2026-09-02 19:38:53 +03:00
vitalif merged commit 2a68ad2a05 into master 2026-09-02 19:39:05 +03:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#84
No description provided.