Repository navigation
fix(compilers/openapi): map sized integer formats to primitives - #728
Open
fuad-daoud wants to merge 3 commits into
Open
fuad-daoud wants to merge 3 commits into
fuad-daoud wants to merge 3 commits into
Conversation
Plans and agent working notes are not part of the repository; what a reviewer needs is in the PR body, the commits and the linked issues. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
formatTablemappedinteger/int32,integer/int64,number/float,number/double,number/decimaland the string formats, and nothing else, so{type: integer, format: int8}lowered to an anonymousScalarovert/prim/integerwithEncoding.Name: int8even thoughir.PrimKindhasPrimInt8.This adds the seven entries naming a width of their base type —
integer/int8,integer/int16,integer/uint8,integer/uint16,integer/uint32,integer/uint64,number/decimal128— at their grouped positions, so those positions now resolve to the sharedt/prim/<kind>primitive: no anonymous node, noEncoding, no diagnostic, andformatHomestill reports the keyword homed through the primitive kind.formatTable's doc comment records the rule.Deliberately unchanged: the literal
float32/float64spellings (float/doublealready map — the table maps OpenAPI format spellings, not TypeSpec type names),float16/uint128(no suchPrimKind),byte's own hoister, and the fallback that hoists an unlisted format as aScalaroverbaseForType— including{type: string, format: int64}(#637).The plan shipped with this fix is at
docs/plans/636-sized-integer-primitives.md.Test plan
go test ./compilers/openapi/internal/schema/ -run TestScalar -count=1— green. The newTestScalar_NumericFormatsMapToPrimitivecovers the seven new pairs, the int32/int64 and float/double/decimal controls, and two fallback boundary rows (number/float16,string/int64); a mapped row asserts the property target isir.PrimTypeID(kind), the node is an*ir.Primitiveof that kind, and not/anon/...node exists at the property pointer.integer/uint32entry reddens theuint32subtest (t/anon/components/schemas/Holder/properties/p4instead oft/prim/uint32); restoring it is green.go test ./compilers/openapi -run TestConformance -count=1— green, no golden changed.make gate— exit 0 (fmt, vet, lint, nolint sweeps, build, coverage-count, coverage 100%, fuzz, bench-smoke).