Epic: Enum fields in API request bodies accept names only #316
Labels
No labels
agent
api-regen
agent
architect
agent
coder
agent
console-coder
agent
docs-writer
agent
mechanic
agent
protocol-coder
agent
storage-coder
area/api
area/ci
area/console
area/dhcp
area/dns
area/docs
area/packaging
area/process
area/storage
area/windows
kind
bug
kind
chore
kind
docs
kind
epic
kind
feature
kind
performance
kind
security
kind
test
priority
high
priority
low
priority
medium
resolution
duplicate
resolution
not-a-bug
resolution
wontfix
status
blocked
status
in-progress
status
needs-decision
status
needs-design
status
ready
theme
ad-samba-dns
theme
alternatives-benchmark
theme
console-toolchain
theme
later
theme
parity-devices
theme
parity-query
theme
post-release-fixes
theme
tracker-setup
theme
valkey
theme
windows-installer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Depends on
#296 API inputs that take an enum as text accept member names only
lantea-one/ninlil
#323 Typed request bodies refuse enum numbers and digit strings
lantea-one/ninlil
#325 Storage read-replica mode settings refuse comma lists
lantea-one/ninlil
#326 The changelog and README say API enum fields take names only
lantea-one/ninlil
Reference
lantea-one/ninlil#316
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
#296 made hand-parsed enum text accept member names only. Enum fields in typed request bodies are bound by JSON converters instead, and they still accept digit strings, and some accept JSON numbers and undefined values. Probed by the #296 verifier through the shared Web test host:
POST /api/dhcp-tag-rulesvendorClassIdentifierMatchMode(anduserClassMatchMode)JsonStringEnumConverter<T>(default options)"1","5"→ 2011,5→ 2015storedPOST /api/zonestypeEnumDescriptionJsonConverter<T>"0"→ 201"99"storedPOST /api/zonesdnssecAlgorithmEnumDescriptionJsonConverter<T>"13"→ 201"200"storedPOST /api/zonesdenialOfExistenceModeEnumDescriptionJsonConverter<T>"1"→ 201"99"storedPOST /api/zones/{id}/dnssec-keysroleEnumDescriptionJsonConverter<T>"1"→ 201"9"storedPOST /api/zones/{id}/dnssec-keysalgorithmEnumDescriptionJsonConverter<T>"13"→ 201"200"→ 400 (controller check)There is no
AddJsonOptionsinProgram.cs; each enum carries a[JsonConverter]attribute.EnumDescriptionJsonConverter(src/dotnet/src/Ninlil.Common.Extension/Converter/EnumDescriptionJsonConverter.cs) resolves strings throughToEnumStringExtension.TryToEnum, which accepts any digit string on purpose, so wire codes without a named member (for example a record type or algorithm number Ninlil does not name) can be read back. That is why this needs a design decision rather than a blanket change.Other text sites the #296 verifier found, outside the hand-parsed list #296 covered:
src/dotnet/src/Ninlil.Web/Services/Storage/StorageConnectionStringAssembler.cs:90,116:Enum.TryParse(..., ignoreCase: true)forSslMode/MySqlSslModefrom the API'sEncryptionMode(StorageModels.cs:190); digit strings pass.src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Topology/MySqlConnectionStringComposer.cs:144andsrc/dotnet/src/Ninlil.Dns.Data.MongoDb/Topology/MongoClientSettingsComposer.cs:204:Enum.TryParseon topology text (MySqlLoadBalance,ReadPreferenceMode); check whether the text comes from the API.src/dotnet/src/Ninlil.Web/Controllers/DnssecPolicySettingsController.cs:118: accepts a defined algorithm as a digit string ("13").What to decide (architect)
What changes (after the decision)
Acceptance
RSASHA256).OpenApiSnapshotTestspasses, or api-regen follows.Source
Verifier report on #296 (
feature/296-enum-names-only).Ghost referenced this issue2026-11-05 14:53:06 -05:00
Ghost referenced this issue2026-11-05 19:14:16 -05:00
Ghost referenced this issue2026-11-05 19:14:49 -05:00
Ghost referenced this issue2026-11-05 19:14:49 -05:00
Ghost referenced this issue2026-11-05 19:14:49 -05:00
Ghost referenced this issue2026-11-05 19:14:49 -05:00
Designed (architect), decisions Q-API-1..4 recorded on #260 (names only everywhere; record data out of scope; query strings in #327; no repair of stored rows). Now an epic. Children: #323 (typed bodies, coder) → #324 (merge patches + storage encryption mode, coder) → #326 (CHANGELOG/README, docs-writer); #325 (replica mode settings, mechanic, independent). An OpenAPI snapshot regen follows #323/#324 only if the document changes.
Enum fields in API request bodies accept member names onlyto Epic: Enum fields in API request bodies accept names onlyGhost referenced this issue2026-11-05 20:00:31 -05:00
All children (#323, #324, #325, #326) merged into develop through PR #328 and closed. No OpenAPI change, so no api-regen child was needed. Query-string enums continue in #327. Closing the epic.