knowledge(web-services): under schema 2.0 an API enum field is a contract by member name, under 1.0 by caption - #149
Conversation
44a5b78 to
07b1499
Compare
Jesper Schulz-Wedde (JesperSchulz)
left a comment
There was a problem hiding this comment.
The name-versus-caption rule needs to be scoped to the OData schema version before agents can use it safely.
For $schemaversion=2.0, the article is correct: enum fields are strongly typed and responses carry encoded AL member names, while captions are available separately through entityDefinitions. But schema version 1.0 exposes enum fields as Edm.String and returns the en-US caption. Custom APIs defaulted to 1.0 through BC23; BC24 changed only the default to 2.0, and callers can still explicitly request ?$schemaversion=1.0.
That reverses both blanket conclusions in the current text for schema 1.0:
- changing a caption can break a consumer that receives that caption in responses;
- renaming a member while retaining its caption does not change that schema-1.0 payload (although AS0082 and dependent-extension/upgrade contracts still prohibit the rename for separate reasons).
Please make the title, Description, Best Practice, Anti Pattern, and detection guard explicitly about schema version 2.0. Do not suppress caption-change findings unless the reviewer can establish schema 2.0 (standard API v2.0, an explicit $schemaversion=2.0, or another reliable context signal). For custom APIs where clients may select either schema, preserve both contracts or version the API. The frontmatter should start at BC17, when API/schema v2.0 was introduced, rather than BC16.
The rename risk under schema 2.0, Dataverse External Name mapping, and the AS0082/AS0083 discussion are otherwise well supported.
|
One addition to my review above, because it affects the evidence rather than just the prose. The PR body presents this as the article's proven remedial value:
That cold reviewer was not wrong. Under So the cold reviewer described schema 1.0 correctly and the article marked it a false positive. That inverts the headline claim: the This means the fix is not only in the wording. The two cold probes that argue for admission need re-running once the article is scoped to schema 2.0, since the caption probe currently counts a correct answer as a miss, and the rename probe was already caught cold when the diff was visible. Please restate what the article is remedial for after scoping — if the honest answer is To be clear about what I am not disputing: the rename risk under schema 2.0, the Dataverse External Name mapping, and the AS0082/AS0083 treatment are all well supported and should survive the rewrite intact. |
…ract by member name, under 1.0 by caption What an API page publishes for an enum field depends on the OData schema version: member names under 2.0, the caption as Edm.String under 1.0, never the ordinal. Custom APIs defaulted to 1.0 through BC 23 and to 2.0 from BC 24. LLMs assert one carrier as universal and get one direction wrong. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
07b1499 to
39a5304
Compare
|
Thanks, you were right on every point, and the caption probe was indeed a correct schema 1.0 answer rather than a false positive. Round 2 is pushed (39a5304):
The cold probes were re-run with fresh reviewers on a BC 22 custom API (runtime 11.0, schema 1.0 by default). The caption-only change was called "safe for API consumers, confidence high" on the belief that "API pages serialize enum fields by the enum member name, never by caption". The rename probe caught the 2.0 break but stated captions "only affect the UI". A no-files knowledge probe put Rename risk under 2.0, the Dataverse External Name mapping and the AS0082/AS0083 treatment are unchanged. |
Jesper Schulz-Wedde (JesperSchulz)
left a comment
There was a problem hiding this comment.
Round 2 addresses everything, and the withdrawal is handled honestly rather than quietly.
The carrier is now conditional on the schema version in the title, Description, Best Practice, Anti Pattern and the detection guard, and the caption carve-out is gated on the reviewer establishing schema 2.0 rather than assumed. The custom-API case — preserve both contracts or version — is the right instruction for the many apps that can still be called either way. bc-version: [17..] matches API v2.0's introduction in 2020 wave 2.
The Evidence rework is the part I care most about: the round-1 false positive is marked withdrawn, and the re-run probes on a BC 22 app are much stronger than what they replace. Three fresh reviewers each asserting a different universal carrier — one of them inventing a v15 cutoff, all at high confidence — is a better admission case than the original, and it is the case the article actually answers.
On the open question in your verdict: another reliable context signal is loose, but I would rather leave it loose than enumerate signals we would have to maintain. The guard is fail-safe as written — ambiguity leads to reporting, not to suppressing — so the vague phrase cannot cause a silent miss. Leaving it.
Thanks for taking the correction on the evidence rather than only the prose.
2439d5c
into
microsoft:main
What
Adds one
web-servicesarticle with a good and a bad sample:community/knowledge/web-services/api-enum-values-are-a-contract-by-name-not-ordinal.md,.good.al,.bad.al.The fact: what an API page publishes for an enum field depends on the OData
$schemaversionthe caller receives. Under schema 2.0 the field is a strongly typed enum and$metadata, responses and$filtercarry the AL member names, with captions published separately throughentityDefinitions. Under schema 1.0 the same field isEdm.Stringand responses carry the en-US caption. Microsoft's API v2.0 is always 2.0; custom APIs defaulted to 1.0 through BC 23, to 2.0 from BC 24, and a caller can still pin 1.0. The ordinal is never the carrier. Dataverse virtual tables match by External Name.Why this is a knowledge file (admission test)
Three fresh cold reviewers, given a BC 22 custom API (schema 1.0 by default), each asserted one carrier as universal. The caption-only change was called "safe for API consumers, confidence high" because "API pages serialize enum fields by the enum member name, never by caption", which is wrong for the schema this app serves. The rename reviewer caught the schema 2.0 break but stated captions "only affect the UI". The knowledge probe put
Edm.Stringin$metadatawith the name in the payload, a mix of both schemas, with an invented version cutoff. The model does not know that the schema version decides, and is confident in both wrong directions. With the article, the caption-only diff on the BC 22 app is flagged with the correct mechanism and the reviewer states it would not have flagged it otherwise.Overlap check
microsoft/knowledge/web-services/version-apis-by-adding-not-mutating-published-versions.md— delta: page-shape contract; a value or caption change inside an unchanged field changes none of it. Cross-referenced.microsoft/knowledge/upgrade/enum-values-additive-at-end.md— delta: persisted rows bind by ordinal; across an API boundary the carrier is the name (2.0) or the caption (1.0). Cross-referenced.$schemaversion,entityDefinitions, External Name, virtual tables, or AS0082.Sources
Edm.String) as cited in the review — https://www.kauffmann.nl/2024/08/22/custom-apis-and-schemaversion-2-0/bc-version: [17..]: API v2.0 and schema 2.0 exist from BC 17.Layer and retrieval
Community layer.
microsoft/skills/review/al-web-services-review.mdalready sources theweb-servicesdomain across layers, so no skill change is needed; review fixtures untouched. Happy to see it promoted if it proves itself.Scope
Left out on purpose: ordinal stability for persisted rows and page-shape versioning, owned by the two cross-referenced Microsoft articles; Dataverse data synchronisation (option-set id mapping) is a different mechanism from virtual tables and is not claimed.
Review history
bc-versionmoved to[17..]; good sample keeps names and captions and shows append plusObsoleteState; cold probes re-run on a BC 22 app, warm reviews re-run; the withdrawn probe is marked as such in the Evidence block. Also: rebased on Avoid Public Event publisher #144, commit re-authored under a linked identity,## See alsoandfalse-positivekeyword added.Evidence
Checklist
domainmatches the folder## Descriptionpresent; no fenced code blocks; under 100 lines; one concernvalidate_frontmatter.py,Test-KnowledgeIndex.ps1,Test-ReviewFixtures.ps1pass locallycommunity/is touchedupstream/main🤖 Generated with Claude Code