Releases: oapi-codegen/oapi-codegen
v1.13.4
What's Changed
- Fix: Generate models for all JSON media types by @jamietanna in #1177
Full Changelog: v1.13.3...v1.13.4
v1.13.3
What's Changed
Full Changelog: v1.13.2...v1.13.3
Fix: Allow multiple JSON types to be generated
What's Changed
- Fix: Allow multiple JSON types to be generated by @jamietanna in #1159
- Bump github.com/matryer/moq from 0.3.1 to 0.3.2 by @dependabot in #1160
- Bump github.com/labstack/echo/v4 from 4.10.2 to 4.11.1 by @dependabot in #1161
- Bump github.com/go-chi/chi/v5 from 5.0.8 to 5.0.10 by @dependabot in #1162
Full Changelog: v1.13.1...v1.13.2
v1.13.1: Various fixes post-release
What's Changed
- feat: support nullable additional properties by @johanneswuerbach in #948
- Bump golang.org/x/tools from 0.9.2 to 0.9.3 by @dependabot in #1084
- Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 by @dependabot in #1085
- Spell "marshal" and "unmarshal" consistently by @alexandear in #1069
- fix: strict server with union type by @johanneswuerbach in #939
- Fix: Only generate optional parameters if present by @jamietanna in #1095
- Fix: nil spec.Component panic on import mapping (#1093) by @cosban in #1116
- Bump github.com/getkin/kin-openapi from 0.117.0 to 0.118.0 by @dependabot in #1105
- Bump github.com/lestrrat-go/jwx from 1.2.25 to 1.2.26 by @dependabot in #1111
- Use native error wrapping by @alexandear in #1098
- Use octal literal style for file permissions by @alexandear in #1097
- Bump golang.org/x/tools from 0.9.3 to 0.11.0 by @dependabot in #1140
- Bump golang.org/x/text from 0.9.0 to 0.11.0 by @dependabot in #1141
- Bump github.com/gofiber/fiber/v2 from 2.46.0 to 2.48.0 by @dependabot in #1150
- Change function comments to start with a name by @alexandear in #1080
- Chi: generate Unimplemented implementation by @lelvisl in #1090
- fix #1147 by @const-tmp in #1148
- Spell "marshal" and "unmarshal" consistently by @alexandear in #1086
- return 404 when no matching route is found by @sonu27 in #1067
- issue-1087 by @Rmarken5 in #1089
- Simplify assign operations: use += and ++ by @alexandear in #1103
- Simplify variable declarations by @alexandear in #1099
- feat: implement skipping pointer type by @gabor-boros in #1102
- Refactor to net.JoinHostPort instead of fmt.Sprintf by @alexandear in #1104
- fix(validation): skip email validation when the types.Email is nullab… by @henripqt in #1107
- Pass request context to ValidateRequest func from pkg/chi-middleware/oapi_validate.go by @pcriv in #1125
- Change generated code to start function comment with the function name by @alexandear in #1128
- fix(template): fix strict-interface template by @sarathsp06 in #1132
- fix(stricttpl): move custom header interpolation after set content-type by @henripqt in #1133
- Various build fixes by @jamietanna in #1157
- Fix: Correct
SilenceServersWarning
condition by @gmtstephane in #1152
New Contributors
- @johanneswuerbach made their first contribution in #948
- @cosban made their first contribution in #1116
- @lelvisl made their first contribution in #1090
- @const-tmp made their first contribution in #1148
- @sonu27 made their first contribution in #1067
- @gabor-boros made their first contribution in #1102
- @henripqt made their first contribution in #1107
- @pcriv made their first contribution in #1125
- @sarathsp06 made their first contribution in #1132
- @gmtstephane made their first contribution in #1152
Full Changelog: v1.13.0...v1.13.1
Fiber support, many PR's merged for bug fixes and improvements
New Functionality
Support has been added for a new router, Fiber
Notable Changes
These changes may affect your code, and possibly some incompatibilities where boilerplate had to be changed to fix issues.
- Gin's Cookie() returns string, not *http.Cookie by @derfenix in #878
- Use gin.IRouter instead of *gin.Engine by @derfenix in #879
- fix generated client code cannot convert UUIDs to string when used as… by @benyaminbeyzaie in #956
- Add form struct tag for x-www-form-urlencoded request schemas by @ivan1993spb in #1000
- Add initialism-overrides flag by @shiv3 in #1007
- Reusable strict middlewares by @Warboss-rus in #1021
- Support for hal+json format by @martinhej in #1030
- fix: Avoid nil reference for gin wrapper by @amweiss in #1057
- Introduce content type into generated JSON types by @jamietanna in #1078
The Rest
- Bump golang.org/x/tools from 0.3.0 to 0.4.0 by @dependabot in #893
- Bump github.com/go-chi/chi/v5 from 5.0.7 to 5.0.8 by @dependabot in #894
- relax validation of discriminators when merging allOf schemas. by @cosnicolaou in #895
- x-enum-varnames revival by @amery in #880
- Bump github.com/matryer/moq from 0.2.7 to 0.3.0 by @dependabot in #875
- Warn when using a non-empty
spec.Servers
by @jamietanna in #883 - This PR addresses issue 896. by @cosnicolaou in #897
- fix(oapi-codegen): package name detection by @stevenh in #873
- AdditionalProperties and oneOf in one Schema by @B-Lorentz in #765
- Reverse the order of the middleware when they applied in gorilla/mux implementation by @mpls104 in #842
- Bump golang.org/x/text from 0.5.0 to 0.6.0 by @dependabot in #921
- Bump github.com/getkin/kin-openapi from 0.107.0 to 0.112.0 by @dependabot in #907
- fix(gin-template): Respect ctx.Abort() by @alexstojda in #914
- Bump github.com/labstack/echo/v4 from 4.9.1 to 4.10.0 by @dependabot in #912
- Bump github.com/gin-gonic/gin from 1.8.1 to 1.8.2 by @dependabot in #908
- Bump golang.org/x/tools from 0.4.0 to 0.5.0 by @dependabot in #920
- change error message when failed parsing date-time in deepObject by @ikorihn in #919
- fix(deps): update kin-openapi to v0.104.0 by @mgabeler-lee-6rs in #953
- Bump golang.org/x/tools from 0.5.0 to 0.6.0 by @dependabot in #964
- Bump golang.org/x/net from 0.5.0 to 0.7.0 by @dependabot in #973
- Bump github.com/labstack/echo/v4 from 4.10.0 to 4.10.2 by @dependabot in #980
- Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 by @dependabot in #981
- Bump golang.org/x/text from 0.6.0 to 0.8.0 by @dependabot in #989
- Bump github.com/gin-gonic/gin from 1.8.2 to 1.9.0 by @dependabot in #1001
- OneOf: Implicit mapping by @Antonboom in #932
- Bump golang.org/x/tools from 0.6.0 to 0.7.0 by @dependabot in #1002
- Bump github.com/matryer/moq from 0.3.0 to 0.3.1 by @dependabot in #1003
- Fix incorrect fieldname reserved keywords in path parameters (strict server) by @reinkrul in #999
- Client With Responses not able to solve external refs by @amammay in #959
- Fix incorrectly generated empty array for security requirements by @benyaminbeyzaie in #955
- Fix README.md example usage by @hjblom in #982
- Add proper Godoc comment for properties marked as deprecated by @papkos in #976
- Use different order of arguments for json merge by @hhelmken in #998
- Fix allOf merges using external refs by @octomad in #941
- fix(oapi-codegen): command line parsing compatibility by @stevenh in #852
- fix959 by @Rmarken5 in #992
- Bump github.com/getkin/kin-openapi from 0.114.0 to 0.115.0 by @dependabot in #1008
- Bump golang.org/x/text from 0.8.0 to 0.9.0 by @dependabot in #1023
- Improve logic for x-omitempty by @veleek in #1033
- Bump golang.org/x/tools from 0.7.0 to 0.8.0 by @dependabot in #1024
- Bump github.com/getkin/kin-openapi from 0.115.0 to 0.116.0 by @dependabot in #1032
- Fix pointers equality in TypeDefinitionsEquivalent function by @spinillos in #952
- Add InternalServerError when err is not nil in strict-gin by @shirou in #1012
- fix: Use helper function to detect general JSON responses by @hikhvar in #945
- Update authenticated example - set token in echo context.. by @sblackstone in #917
- Fix AdditionalPropertiesType Propagation by @FragmentedPacket in #1017
- Assign values of type Map in deep objects by @goblindegook in #934
- chore: move install mapping to global state by @stevenh in #853
- Handle empty application/json request bodies by @kurtinge in #1043
- fixes an error message containing a nil err object by @mwasilew2 in #1048
- Add ability to try to get templates from files or remotes by @deefdragon in #968
- Cmd flags usage: uppercase first letter, and end with a period by @alexandear in #1073
- add links to source in the README.md file by @BigBoulard in #1071
- Bump github.com/getkin/kin-openapi from 0.116.0 to 0.117.0 by @dependabot in #1054
- Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 by @dependabot in #1053
- Bump golang.org/x/tools from 0.8.0 to 0.9.1 by @dependabot in #1049
- Fix typos in comments by @alexandear in #1050
- checking query params for nil value by @yuoppp in #1064
- Bump golang.org/x/tools from 0.9.1 to 0.9.2 by @dependabot in #1076
- Bump github.com/gin-gonic/gin from 1.9.0 to 1.9.1 by @dependabot in #1077
- Refactor to use strings.ReplaceAll by @alexandear in #1079
New Contributors
- @cosnicolaou made their first contribution in #895
- @amery made their first contribution in #880
- @B-Lorentz made their first contribution in #765
- @mpls104 made their first contribution in #842
- @alexstojda made their first contribution in #914
- @ikorihn made their first contribution in #919
- @Antonboom made their first contribution in #932
- @reinkrul made their first contribution in #999
- @amammay made their first contribution in #959
- @benyaminbeyzaie made their first contribution in #956
- @hjblom made their first contribution in #982
- @papkos made their first contribution in #976
- @ivan1993spb made their first contribution in #1000
- @hhelmken made their first contribution in #998
- @octomad made their first contribution in https://github.com/deepmap/oapi-codegen/...
Ensure Scopes context key are generated as valid Go names
As highlighted by @KenxinKun in #874, gorilla/mux (as well as some other servers) were affected by an invalid Scopes context key.
This makes them valid Go names.
Fix the generated error handling for Gin
In v1.12.0 we added support for custom error handling to be used in the generated Gin code.
Unfortunately, we didn't produce the right code, so this would cause (compilation) errors.
Fix big issue with marshaling binary strings
v1.12.0 introduced a File
type which intercepts schemas of type:string, format:binary
, but it incorrectly implemented the json.Marshaler
interface and was lacking tests to catch the problem. This version fixes the marshaling of fields of that type.
Prior versions of oapi-codegen turned those into a []byte
, and you can still annotate your spec with x-go-type
if you need []byte
Fix an issue with command line parsing
- The
-o
flag specifying the output filename was being ignore in very simple invocations of oapi-codegen without a configuration file. This is fallout from trying to be compatible with old and new style configs.
Many bug fixes
Major changes to functionality
- In the last release, we changed the configuration file format to a new syntax, and added flags to read the old version, but it turns out that this default-on change broke a lot of automation, sorry about that. In this release, we've done our best to auto-detect the configuration version, so both styles of config options should work. The explicit version selection flags have not been removed.
- Gorilla router (#594)
- "strict" server generation, meaning one which is much more pedantic about input and output types, which allows for making API clients and servers that look more like Go functions than HTTP handlers (#499)
- Fields can be marked with
x-json-ignore
to omit in JSON serialization (#390) - Many fixes to unions for
oneOf
andanyOf
handling, thank you committers. - Enums can be prefixed with their typename in all cases, versus only on collisions previously. This is a configurable option (#662)
- The
Client
interface in generated code was named awfully generically. You can now override the name (#788) - Generate code can be optionally formatted using more initialisms. It's default-off to not break existing code (#749)
- Gin code can be configured with a custom error handler, versus generating error responses inline. Default behavior is the same as before (#587)
- Gin middleware evaluation order can be reversed to be consistent with common Gin usage, it's default-off to not break previous behavior. ( #787)
Everything that has changed
This is a very large release with many bug fixes. Thanks to all contributors.
- use BindStyledParameterWithLocation with path params by @jcalvarado1965 in #564
- Correct reference to flag for backwards compatible configuration by @jamietanna in #594
- Add support for Gorilla generation by @jamietanna in #585
- chi : Change the signature of the
MiddlewareFunc
for compatibilities. by @uhey22e in #578 - docs: replace go get with go install by @mycrEEpy in #588
- oneOf/anyOf support (including discriminator) by @Warboss-rus in #471
- refactor(pkg/codegen): add goCode to error by @sashamelentyev in #599
- Add missing space between words by @jamietanna in #589
- [#211] Generate OpenAPI dictionaries without fixed keys as maps by @natsukagami in #424
- Fix UUID query param binding by @karl-dau in #623
- Strict server generation by @Warboss-rus in #499
- comment fixed in gin example code by @nsaltun in #646
- Fix small typo in comment by @LelouBil in #641
- Support param styling for UUIDs by @rliebz in #643
- Allow binding types as parameters through
String()
methods by @jamietanna in #638 - fix: support encoding.TextMarshaler in StyleParamWithLocation by @mazitovt in #634
- implement new field: x-go-type-import by @VladimirStepanov in #633
- Fix x-go-type-import code generation by @WesleyMiller1998 in #682
- Correct YAML config example by @jamietanna in #665
- fix: percent in enum values by @corani in #664
- Order request body definitions by content type by @mikesep in #686
- Add option to prefix enum values with their typename by @corani in #662
- Update README config example to use the new schema by @tfaller in #613
- Remove generation of code to handle optional query parameters by @jamietanna in #671
- Fix: Handle unset
union
map type by @jamietanna in #650 - Allow providing custom error funcs in strict chi server by @chadweimer in #649
- Add test for empty enum value by @tfaller in #612
- Update README to match the new syntax by @lzap in #630
- Fix: gorilla required header error shadowing by @wmarinic in #689
- Allow merging multiple union types by @jamietanna in #670
- Fix readonly+required property by @florentchauveau in #605
- Fix Date (header) param binding by @hslatman in #628
- Generate type names in GoDoc comments by @jamietanna in #601
- Add basic automated builds by @jamietanna in #602
- Allow custom JSON media types to be marked as
IsJson
by @jamietanna in #582 - handle oapi3.MultiError messages by @joerocklin in #572
- Finish
spec
documentation by @jamietanna in #706 - Document the README may not be latest tag by @jamietanna in #705
- Correct error message for new flag by @jamietanna in #699
- Add support for strict server with Gorilla by @DouglasDwyer in #716
- Remove io/ioutil by @leonnicolas in #727
- BindStringToObject() allows silent overflow of narrower-than-64-bit numeric types by @danielbprice in #740
- Fix/handle initial digit of http header by @masu-mi in #733
- Strongly typed responses for strict server by @Warboss-rus in #701
- Be more flexible parsing config files. by @deepmap-marcinr in #747
- Ft/remove loop by @masu-mi in #750
- Bump github.com/labstack/echo/v4 from 4.7.2 to 4.9.0 by @dependabot in #767
- Correctly
go:generate
test client code by @jamietanna in #772 - Fix a bug where strict json decoder is not used. by @Fethbita in #757
- Migrate deprecated io/ioutil package to io and os packages by @mycrEEpy in #755
- Fix docs by @alexpts in #754
- Migrate to
tidied
by @jamietanna in #725 - Added implementation of x-json-ignore by @sparshev in #390
- Update go to 1.18 by @mycrEEpy in #756
- Default integer data types to
int
when using custom formats by @bearcherian in #741 - chore: Update dependencies by @mycrEEpy in #780
- cleanup: Remove dependency github.com/cyberdelia/templates by @mycrEEpy in #781
- fixed typo by @kosuke-taniguchi in #779
- fix typo by @nandedamana in #792
- Fix #737: CLI documentation by @nandedamana in #797
- Rewrite imports parsing (issue #760) by @VladimirStepanov in #804
- Add Problem Details content types by @veleek in #802
- fix 794 (no error message for invalid CLI options placed after the in… by @nandedamana in #796
- Generate names with initialisms by @wtertius in #749
- Fixed #719: fix generate for union methods. by @insidieux in #720
- Chain Chi middlewares in reverse order so they execute first-to-last by @ericvolp12 in #787
- chore: Fix comments/imports by @Jleagle in #789
- Add extra JSON type checking by @AnnaDodson in #808
- Ensure embedded spec contains all necessary OpenAPI documents by @jamietanna in #771
- Onboard to Dependabot by @jamietanna in #815
- Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in #816
- Bump github.com/labstack/echo/v4 from 4.9.0 to 4.9.1 by @dependabot in #818
- Bump golang.org/x/tools from 0.1.12 to 0.2.0 by @dependabot in https://github.com/deepmap/oapi-codege...