Commit aee9d31
Add support for path aliases
Closes #223
When an OpenAPI spec uses $ref to alias one path to another (e.g.
/test2: $ref: '#/paths/~1test'), kin-openapi inlines the referenced
path item into both entries. Previously this produced duplicate
ServerInterface methods, wrapper functions, and type definitions —
generating Go code that never compiled.
Detect internal path aliases via PathItem.Ref (only when it starts
with "#/paths/", to distinguish from external file references). For
alias operations:
- Server: skip interface method, wrapper, and strict handler generation.
Route registration still emits both paths, pointing to the canonical
wrapper via the new HandlerName() method on OperationDefinition.
- Client: generate methods with a suffixed OperationId (e.g.
GetTestAlias0) so each aliased path gets its own request builder
targeting the correct URL.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent af135a9 commit aee9d31
File tree
40 files changed
+657
-54
lines changed- internal/test/pathalias
- pkg/codegen
- templates
- chi
- echo
- v5
- fiber
- gin
- gorilla
- iris
- stdhttp
- strict
40 files changed
+657
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments