github go-goyave/goyave v3.0.0-rc1
Pre-release v3.0.0-rc1

latest releases: v5.4.1, v5.4.0, v5.3.0...
pre-release4 years ago
  • Changed conventions:
    • validation.go and placeholders.go moved to a new http/validation package.
    • Validation rule sets are now located in a request.go file in the same package as the controller.
  • Validation system overhaul, allowing rule sets to be parsed only once instead of every time a request is received, giving better overall performance. This new system also allows a more verbose syntax for validation, solving the comma rule parameter value and a much easier use in your handlers.
  • Routing has been improved by changing how validation and route-specific middleware are registered. The signature of the router functions have been simplified by removing the validation and middleware parameters from Route(), Get(), Post(), etc. This is now done through two new chainable methods on the Route: route.Validate() and route.Middleware().
  • Log Formatter now receive the length of the response (in bytes) instead of the full body.
  • Configuration system has been revamped.
    • Added support for tree-like configurations, allowing for better categorization. Nested values can be accessed using dot-separated path.
    • Improved validation: nested entries can now be validated too and all entries can have authorized values. Optional entries can now be validated too.
    • Entries that are validated with the int type are now automatically converted from float64 if they don't have decimal places. It is no longer necessary to manually cast float64 that are supposed to be integers.
    • More openness: entries can be registered with a default value, their type and authorized values from any package. This allows config entries required by a specific package to be loaded only if the latter is imported.
    • Core configuration has been sorted in categories. This is a breaking change that will require you to update your configuration files.
    • Entries having a nil value are now considered unset.
    • Added accessors GetInt() and GetFloat().
    • Added LoadFrom(), letting you load a configuration file from a custom path.
    • Added the ability to use environment variables in configuration files.
    • Bug fix: config.IsLoaded() returned true even if config failed to load.
  • Rule functions don't check required parameters anymore. This is now done when the rules are parsed at startup time. The amount of required parameters is given when registering a new rule.
  • Optimized regex-based validation rules by compiling expressions once.
  • A significant amount of untested cases are now tested.
  • Protect the database instance with mutex.
  • Recovery middleware now correctly handles panics with a nil value.
  • The following rules now pass if the validated data type is not supported: greater_than, greater_than_equal, lower_than, lower_than_equal, size.
  • Type-dependent rules now try to determine what is the expected type by looking up in the rule set for a type rule. If no type rule is present, falls back to the inputted type. This change makes it so the validation message is correct even if the client didn't input the expected type.
  • Fixed a bug triggering a panic if the client inputted a non-array value in an array-validated field.
  • response.Render and response.RenderHTML now execute and write the template to a bytes.Buffer instead of directly to the goyave.Response. This allows to catch and handle errors before the response header has been written, in order to return an error 500 if the template doesn't execute properly for example.
  • Test can now be run without the -p 1 flag thanks to a lock added to the goyave.RunTest method. Therefore, goyave.TestSuite still don't run in parallel but are safe to use with the typical test command.
  • maxUploadSize config entry now supports decimal places.
  • Added database connection initializers.
  • Re-organised the goyave.Response structure fields to save some memory.
  • Added the ability to regsiter new SQL dialects to use with GORM.
  • database.Close() can now return errors.
  • Added response.GetStacktrace(), response.IsEmpty() and response.IsHeaderWritten().
  • Removed deprecated method goyave.CreateTestResponse(). Use goyave.TestSuite.CreateTestResponse() instead.
  • Export panic and error status handlers so they can be expanded easily.

Don't miss a new goyave release

NewReleases is sending notifications on new releases.