| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Bring the fiber and iris strict-server interface templates back into parity with the canonical stdhttp template (`strict-interface.tmpl`). Four pieces of drift were addressed: 1. Nullable / optional response-header serialization. Both templates now use the same three-way switch on `.IsNullable` / `.IsOptional` / default that PR oapi-codegen#2301 introduced for stdhttp, so unspecified nullable values and nil optional pointers are skipped instead of being stringified into the wire header. 2. Response-header struct field types. The `{{$opid}}{{$statusCode}}ResponseHeaders` struct now uses `{{.GoTypeDef}}` (pointer/nullable-aware) rather than the raw `{{.Schema.TypeDecl}}`, matching the type that the typed-body Visit function expects. 3. `$ref` Text responses. The fixed-status-code + ref branch now matches Multipart and Text together (PR oapi-codegen#2225), so `$ref` text responses alias directly to the component response type. Iris additionally drops its unconditional `type X string` short-circuit, which previously masked `$ref`, `$hasHeaders`, and `$fixedStatusCode` for any text response. 4. `$ref` name qualification (fiber only). Switch from `ucFirst` to `ucFirstWithPkgName` so external-ref response types carry their package qualifier, matching stdhttp and iris. Regenerated fixtures under `internal/test/strict-server/{fiber,iris}/server.gen.go` demonstrate the change for items (1) and (2); items (3) and (4) have no existing fiber/iris fixture coverage. The no-content `Visit*Response` branch still renders headers unconditionally in all three templates (including stdhttp); that gap is tracked separately (oapi-codegen#2349) and not addressed here. Fixes: oapi-codegen#2331 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR synchronizes the fiber and iris strict-server interface templates with the canonical strict-interface.tmpl (stdhttp), fixing four areas of drift: nullable/optional response-header serialization, header struct field types (GoTypeDef instead of Schema.TypeDecl), $ref text-response aliasing, and package-qualified external ref names for fiber. The generated fixture diffs for items (1) and (2) look correct and appropriately scoped; items (3) and (4) have no existing fixture coverage, as the PR acknowledges. Confidence Score: 4/5Safe to merge; all findings are P2 — the breaking field-type change is intentional and fixes a bug, but warrants release-note callout. All findings are P2: the string → *string field type change is a compile-breaking change for downstream users (custom rule §3) but is fixing an incorrect prior behavior; the no-content header branch inconsistency is pre-existing and tracked in #2349; missing fixture coverage for the iris text $ref path is acknowledged by the author. No logic errors or security issues found. No files require special attention; the template changes look structurally correct and match stdhttp. Important Files Changed
Comments Outside Diff (1)
Reviews (1): Last reviewed commit: "Synchronize strict servers" | Re-trigger Greptile |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Bring the fiber and iris strict-server interface templates back into parity with the canonical stdhttp template (strict-interface.tmpl). Four pieces of drift were addressed:
Nullable / optional response-header serialization. Both templates now use the same three-way switch on .IsNullable / .IsOptional / default that PR support optional/nullable response headers #2301 introduced for stdhttp, so unspecified nullable values and nil optional pointers are skipped instead of being stringified into the wire header.
Response-header struct field types. The {{$opid}}{{$statusCode}}ResponseHeaders struct now uses {{.GoTypeDef}} (pointer/nullable-aware) rather than the raw {{.Schema.TypeDecl}}, matching the type that the typed-body Visit function expects.
$ref Text responses. The fixed-status-code + ref branch now matches Multipart and Text together (PR fix(strict-server): generate correct type for $ref text responses #2225), so $ref text responses alias directly to the component response type. Iris additionally drops its unconditional type X string short-circuit, which previously masked $ref, $hasHeaders, and $fixedStatusCode for any text response.
$ref name qualification (fiber only). Switch from ucFirst to ucFirstWithPkgName so external-ref response types carry their package qualifier, matching stdhttp and iris.
Regenerated fixtures under internal/test/strict-server/{fiber,iris}/server.gen.go demonstrate the change for items (1) and (2); items (3) and (4) have no existing fiber/iris fixture coverage.
The no-content Visit*Response branch still renders headers unconditionally in all three templates (including stdhttp); that gap is tracked separately (#2349) and not addressed here.
Fixes: #2331