Skip to content

v0.17.0: 🎄 Experimental Gin support

Latest
Compare
Choose a tag to compare
@EwenQuim EwenQuim released this 24 Dec 02:29
· 9 commits to main since this release
c93b8d1

v0.17 Highlights 🔥

Merry Christmas! 🎄 And thank you to my little sister that was the 1000th star of this repo ❤️

Experimental Gin support

We're happy to tell you that Fuego now supports Gin router !!!

For the moment, only a subset of Fuego's features are enabled (OpenAPI mostly). We don't have plugged validation, transformation... yet, but this will be available on the next release in January. For the moment, don't hesitate to play with this module and raise issues if you spot a bug.

Middlewares

Are now explicited and declared in the spec! Middlewares were often described in Go as opaque, magic and error-prone. Not with Fuego: they cannot hide anymore!

image

OpenAPI Responses

With option.DefaultStatusCode, you can change the default status code for the happy path.

And with AddResponse, you can declare your custom "non-happy-path" responses! You can also easily declare responses of the pure net/http controllers if you're using these instead of Fuego controllers. Can be a first step towards type safety while keeping flexibility while migrating, for example.

BREAKING: if you were using AddError, switch to AddResponse please!

BREAKING: Context update

We're changing Fuego's signature from "generic type constrained by interface" to an interface. Now, you can more easily stub it in your tests!

Simply replace *fuego.ContextNoBody by fuego.ContextNoBody and *fuego.ContextWithBody by fuego.ContextWithBody

Automatically make all required changes:

For macOS (BSD sed):

find . -type f -exec sed -i '' 's/\*fuego\.ContextNoBody/fuego\.ContextNoBody/g; s/\*fuego\.ContextWithBody/fuego\.ContextWithBody/g' {} +

For Linux (GNU sed):

find . -type f -exec sed -i 's/\*fuego\.ContextNoBody/fuego\.ContextNoBody/g; s/\*fuego\.ContextWithBody/fuego\.ContextWithBody/g' {} +

What's Changed

  • Adds a direct reference to the OpenAPI object in the BaseRoute object by @EwenQuim in #271
  • refactor: set openapi server url as close to startup as possible by @dylanhitt in #273
  • feat: AddResponse by @dylanhitt in #274
  • chore: cleanup some status codes and godoc by @dylanhitt in #277
  • Description option : override + default description contains the list of middlewares by @EwenQuim in #275
  • Refactor, mutualize and document Route object by @EwenQuim in #279
  • Cli/add service generation by @rizerkrof in #256
  • BREAKING: update WithGlobalResponseType to take by @dylanhitt in #276
  • Set status code before returning when no data by @EwenQuim in #282
  • Removes unused generator field from the Server struct by @EwenQuim in #283
  • BREAKING CHANGE: Remove pointer from ContextNoBody and ContextWithBody, use interface directly in handlers by @EwenQuim in #286
  • chore: remove previously deprecated WithPort by @dylanhitt in #289
  • Mutualise a part of Context between net/http and gin by @EwenQuim in #288
  • Moved all non-net/http related code to the new Engine struct by @EwenQuim in #290
  • chore: change RunTLS test to use require.Eventually/httptest by @dylanhitt in #292
  • Optionshow by @dylanhitt in #291
  • chore: comment Deprecatd -> OptionDeprecated by @dylanhitt in #295
  • Updated all dependencies and requires Go 1.23 by @EwenQuim in #301
  • Generic main handler by @EwenQuim in #300
  • Gin compat by @EwenQuim in #260

Full Changelog: v0.16.2...v0.17.0