You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+97Lines changed: 97 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1796,6 +1796,103 @@ However, for more complex URLs that defined `variables` in them, we generate the
1796
1796
1797
1797
For a complete example see [`examples/generate/serverurls`](examples/generate/serverurls).
1798
1798
1799
+
### Duplicate types generated for clients's response object types
1800
+
1801
+
When generating the types for interacting with the generated client, `oapi-codegen` will use the `operationId` and add on a `Request` or `Response` suffix.
1802
+
1803
+
However, this can clash if you have named your component schemas in a similar way.
1804
+
1805
+
For instance:
1806
+
1807
+
```yaml
1808
+
openapi: "3.0.0"
1809
+
info:
1810
+
version: 1.0.0
1811
+
title: "Show that generated client boilerplate can clash if schemas are well named i.e. `*Request` and `*Response`"
This will then rename the generated types from the default to use the new suffix:
1884
+
1885
+
```diff
1886
+
-type UpdateClientResponse struct {
1887
+
+type UpdateClientResp struct {
1888
+
Body []byte
1889
+
HTTPResponse *http.Response
1890
+
JSON400 *UpdateClientResponse
1891
+
}
1892
+
```
1893
+
1894
+
There is no currently planned work to change this behaviour.
1895
+
1799
1896
## Generating API models
1800
1897
1801
1898
If you're looking to only generate the models for interacting with a remote service, for instance if you need to hand-roll the API client for whatever reason, you can do this as-is.
0 commit comments