Releases: go-goyave/goyave
Releases · go-goyave/goyave
Release v5.9.0
- Added
CommonWriter.Writer()
to retrieve the underlying writer. - Compression:
- Fixed an error raised in case of no content responses (HTTP
204
notably) when using the compress middleware. - Added the header
Vary: Accept-Encoding
if a response is compressed. - Set the
Content-Encoding
header only if the response is compressed. The header won't be added anymore for no content responses.
- Fixed an error raised in case of no content responses (HTTP
- Prevent
Response.JSON()
andResponse.String()
from overriding the response status after the headers have been written, which could lead to incorrect information given to other components such as the access logger. - Error handling edge cases improvements:
- The panic status handler (
500
) is now executed too if an error happens after writing to the response. Previously, the panic status handler was executed just like any other status handler: only if the response is empty. This allows better error handling in scenarios such as streaming, SSE, etc. - The panic status handler (
500
) doesn't attempt to write to the response body anymore if a non-500 header has already been written. - The recovery middleware doesn't override the status if header has already been written. This avoids inconsistencies between real response and logged response.
- The panic status handler (
Full Changelog: v5.8.1...v5.9.0
Release v5.8.1
- Better IPv6 support:
- Fixed an error when starting the server when
server.host
was an IPv6. server.Host()
,server.BaseURL()
andserver.ProxyBaseURL()
properly format IPv6 hosts with enclosing square brackets, which also fixesroute.BuildURL()
androute.BuildProxyURL()
when the host is an IPv6.server.BaseURL()
now converts::
to::1
(IPv6 loopback).
- Fixed an error when starting the server when
Full Changelog: v5.8.0...v5.8.1
Release v5.8.0
- Added HTTP 2 configuration to
goyave.Options
.
Full Changelog: v5.7.0...v5.8.0
Release v5.7.0
util/walk
packagewalk.Path
:Path
now support escaping characters (.
,[
,]
,*
,\
) using a backslash. ( #236 by @achimoraites )Path.String()
outputs the path with the escape characters.- Improved illegal path syntax error to make it easier for developers to troubleshoot.
- New methods:
Path.IsWildcard
: returns true if the path has unescaped "*" as Name.Path.UnescapedString
: returns a string representation of the path without the escape characters.
- New function
Unescape
: remove escape characters from a path without parsing it.
- Validation:
- field paths in rule sets now support escaping characters using a backslash.
- validating both the the literal object fields and the wildcard (
*
) isn't allowed anymore. This goes with the same logic as the repeated paths rule introduced in v5.6.0. - minor optimizations.
- Added support for bigquery database dialect. You must disable prepared statements for the dialect to work, as this is not supported by this driver. ( #238 by @pn03 )
- Upgraded to golangci-lint v2. New rules and changes to the configuration were made. Minor changes to the codebase were made to fix the newly reported lint issues.
- Updated dependencies.
Full Changelog: v5.6.1...v5.7.0
Release v5.6.1
- Fixed default language entry for the validation error message of the
KeysIn
validator. KeysIn
validator now accepts any concrete type string. This allows the use of type aliases.
Full Changelog: v5.6.0...v5.6.1
Release v5.6.0
typeutil.Undefined improvements (#244)
With the introduction of the json omitzero
tag in Go 1.24, the typeutil.Undefined
type has been improved to support json marshaling and SQL scanning. If used in combination with the omitzero
tag, the marshaling behavior will now be as expected for a non-present field. This means the type can now be used in models and response DTOs to selectively make fields visible or not in a response.
- Added the
Set
andUnset
convenience methods. - Improved documentation.
- Handle more cases in the
sql.Scanner
implementation to supportUndefined[T]
,*Undefined[T]
,T
or*T
values as input. typeutil.Undefined
now implementsjson.Marshaler
. Only theValue
is marshaled as opposed to previously where the entire struct was marshaled.
Validation
Bug fixes
- Fixed incorrect validation order when using composition for array elements. (#259)
- Repeated paths in a rule set are not allowed anymore and will result in a panic. This incorrect usage of
RuleSet
could lead to buggy behavior. (#259) - Fixed "illegal syntax" error when using ruleset composition for an array of objects. (#247)
New features
- Added the
Init()
method to thevalidation.Validator
interface. (#246)- This allows initializing validators in unit tests.
- This method can be overridden by developers in custom validators in case some additional custom values must be defined at initialization.
- This change doesn't require any change in existing code-bases as the new method is already implemented by
BaseValidator
.
- Added
validation.WithMessage()
, which overrides the language entry used to render the error message of a validator. (#260)- Original placeholders returned by the validator are still used to render the message.
- Type-dependent and "element" suffixes are not added when the message is overridden.
- Added
validation.OnlyIf()
validator, which executes a validator only if a condition is met. It can be useful for conditional validation. (#258)
Miscellaneous
- Upgraded
github.com/golang-jwt/jwt
togithub.com/golang-jwt/jwt/v5
so theauth.JWTService
can benefit from the latest features and security. This is not a breaking change but you will need to update your import path if you use theauth.JWTController.SigningMethod
field. (#254) - On successful authentication, the user is now injected in the request's
context.Context
. (#261)- The user can be retrieved from the context using the new function
auth.UserFromContext()
.
- The user can be retrieved from the context using the new function
Full Changelog: v5.5.6...v5.6.0
Release v5.5.6
Release v5.5.5
- In validation, fixed a panic when trying to convert a
nil
single value array using theConvertSingleValueArrays
option. - Retract v5.5.4 as it introduced a bug: when a non-nullable field was provided and thus removed from the request, its associated validators were still executed.
- Fixed the bug introduced in v5.5.4.
Release v5.5.4
- Retract v5.5.3 as it introduced a bug in the absence detection for the root element (if
validation.CurrentElement
wasn't required). - Fixed the bug introduced in v5.5.3
Release v5.5.3
- In validation, fixed nullable field absence detection. This fixes validators on nullable fields being executed even if the field is not present at all in the request.