Skip to content

v1.4.0 Upgrade Go & Support Error Source in JSONAPI Package

Latest

Choose a tag to compare

@insomnius insomnius released this 04 Apr 16:44

Release Notes

New Features

  • Error Source Parameter Support:
    The jsonapi package now supports specifying error sources using the WithSourcePointer, WithSourceParameter, and WithSourceHeader options. These options allow developers to provide detailed references to the primary source of an error, such as JSON pointers, query parameters, or request headers.
    Example usage:
    response := jsonapi.BuildResponse(
      jsonapi.WithException("ERR400", http.StatusBadRequest, exception.Throw(
      	errors.New("complex error"),
      	exception.WithDetail("Complex error with multiple sources"),
      	exception.WithTitle("Bad Request"),
      ),
      	jsonapi.WithSourcePointer("/data"),
      	jsonapi.WithSourceParameter("sort"),
      	jsonapi.WithSourceHeader("X-Custom"),
      ),
    )

Updates

  • Go Version Upgrade:
    The project has been updated to use Go 1.24, ensuring compatibility with the latest language features, performance improvements, and security updates. Developers are encouraged to update their Go environment to version 1.24 to take full advantage of these enhancements.

Notes

  • Ensure that your Go environment is updated to version 1.24 before building or running the project.
  • The new error source options enhance error reporting and debugging, making it easier to identify and resolve issues in API requests.

Full Changelog: v1.3.1...v1.4.0