Skip to content

fix example codegen#2354

Merged
mromaszewicz merged 2 commits into
oapi-codegen:mainfrom
mromaszewicz:chore/examples-codegen
Apr 30, 2026
Merged

fix example codegen#2354
mromaszewicz merged 2 commits into
oapi-codegen:mainfrom
mromaszewicz:chore/examples-codegen

Conversation

@mromaszewicz

Copy link
Copy Markdown
Member

aae687c broke example codegen, since the "generate" directory caused the "make generate" rule not to run, since it already existed. It needs to be .PHONY. I'll refactor examples a bit later.

aae687c broke example codegen, since
the "generate" directory caused the "make generate" rule not to run, since
it already existed. It needs to be .PHONY. I'll refactor examples a bit
later.
@mromaszewicz mromaszewicz requested a review from a team as a code owner April 30, 2026 14:41
@mromaszewicz mromaszewicz added this to the v2.7.0 milestone Apr 30, 2026
@greptile-apps

greptile-apps Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the root cause of stale example codegen: the generate/ subdirectory was silently shadowing the generate Make target, preventing make generate from running. Adding .PHONY: generate to examples/Makefile restores correct behavior, and all 52 generated example files have been fully regenerated against the current toolchain (v2.6.0), picking up accumulated template improvements (per-operation middleware via RegisterHandlersOptions, ContentType() on response types, HTTP method constants).

Confidence Score: 5/5

Safe to merge — targeted fix with consistent, expected regeneration output across all examples

The Makefile change is a one-liner .PHONY fix that is clearly correct. All generated file diffs are consistent with a full regeneration: uniform version bump to v2.6.0 and only template-driven additions (no removals of existing exported identifiers, no signature changes). The go.mod tool directive is the idiomatic Go 1.24+ way to pin code-generator tooling. No unrelated churn, no missing files, no unexpected drift.

No files require special attention

Important Files Changed

Filename Overview
examples/Makefile Core fix: adds .PHONY: generate so the generate target always runs regardless of the generate/ directory's existence
examples/go.mod Updates oapi-codegen version requirement to v2.6.0 (functionally replaced by ../ via replace) and adds Go 1.24 tool directive for reproducible code generation
examples/minimal-server/echo/api/ping.gen.go Representative regenerated file: version string updated to v2.6.0, gains RegisterHandlersOptions/RegisterHandlersWithOptions and per-operation middleware support
examples/client/client.gen.go Regenerated: version bump, HTTP method string literals replaced with constants, ContentType() helper method added to response types
examples/petstore-expanded/echo/api/petstore-server.gen.go Regenerated petstore server: version bump only, consistent with other regenerated files

Reviews (1): Last reviewed commit: "fix example codegen" | Re-trigger Greptile

@mromaszewicz mromaszewicz merged commit 9643421 into oapi-codegen:main Apr 30, 2026
17 checks passed
@mromaszewicz mromaszewicz deleted the chore/examples-codegen branch April 30, 2026 16:36
@jamietanna

Copy link
Copy Markdown
Member

Oops 😅 dang makefiles!

@jamietanna jamietanna added the chore Any maintenance tasks that are regular, not as important to call out in the changelog label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Any maintenance tasks that are regular, not as important to call out in the changelog internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants