Releases: gopher-fleece/gleece
New `dump graph` command
v2.0.0
Gleece v2.0.0
Summary
Gleece 2.0 brings in concrete support for type aliases, map input/outputs and an overhauled type resolution system.
Features
-
Support for type aliasing.
Previously, alias support was limited and resulted in the aliased type effectively wiping the alias itself.Both declared and assigned aliases are valid:
// A unique ID type Id string `validate:"regex=^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$"` // A unique ID type Id = string `validate:"regex=^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$"`
These aliases will be translated into an equivalent OpenAPI model:Id: type: "string" format: "^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$" description: "A unique ID"
-
Full support for
map.
Previously, non-primitive maps likemap[string]something.Somethingwould not resolve correctly, resulting errors. -
Infrastructure-level support for generics
Generics support represent Gleece's next major milestone.This change includes the necessary infrastructure.
These include expansion of the HIR to encode the one-to-many relationships between composites (e.g.Something[string, bool, int]) and their instantiated dependencies (e.g.string,boolandint)Below you can see a graphical dump of a controller with generics in use:
-
Added an configuration option to disable failure after encountering issues during package loads.
To use this option, create a
failOnAnyPackageLoadError(boolean) field under thecommonConfigsection of yourGleece Configfile, e.g.:{ "commonConfig": { "failOnAnyPackageLoadError": false, "controllerGlobs": [ "./*.go", "./**/*.go" ] }, ... ... ... }For some complex environments, specifically those using generated code, there sometimes is a need to ignore package load errors.
A typical use case is when the project has controllers and generated code in the same directory hierarchy with no discernable naming patterns.
Gleece may attempt to load the yet-to-be-generated code and fail.
This configuration option is an 'escape hatch' for these cases.
Enhancements
-
Overhauled type resolution flows.
Gleece now has a set of composable visitors, each tailored for a specific part of the AST.
-
Added a global
ApiValidatoras the entry point to the HIR validation subsystem.
This currently includes a URL conflict detection algorithm to emit diagnostics upon route conflicts such as betweenPOST /a/b/candPOST /a/{foo}/c -
Added an explicit visitor error when using interfaces in general and
interface{}in particular -
Added a validation error when passing arrays via inputs that do not accept them (i.e., a URL parameter)
Bugfixes
-
Fixed array/slice support. Previously resulted in broken generated code
-
Fixed cases where model fields were named after the type rather than the field name or JSON tag
-
Fixed an issue where
anyyielded anobjectschema entity rather than a 'map-like' one, i.e.,
"someField": {
"additionalProperties": {
"type": "object"
},
"type": "object"
}v1.5.4
v1.5.3
What's Changed
- Allow Skip Generated date in generated routes comment by @haimkastner in #50
Full Changelog: v1.5.2...v1.5.3
v1.5.2
What's Changed
- Adding support for models with pointer-type fields by @haimkastner & @yuval-po in #49
Full Changelog: v1.5.1...v1.5.2
v1.5.1
What's Changed
- Force sort for template generated routes by @haimkastner in #48
Full Changelog: v1.5.0...v1.5.1
v1.5.0
What's Changed
- BREAKING - Adding support for Receiver Context Injection by @haimkastner & @yuval-po in #46
- Remove "gleece" from the default root of error instance path by @haimkastner in #47
Full Changelog: v1.4.4...v1.5.0
v1.4.4
v1.4.3
What's Changed
- Cleanups & Tests by @yuval-po in #40
- Bugfixes, tests and QOL changes by @yuval-po in #41
- Add missing support on openapi security schema by @haimkastner in #42
- Validate missing path params in URL by @haimkastner in #43
- Rename aux file name due to "aux" Windows issue by @haimkastner in #44
Full Changelog: v1.4.1...v1.4.3
v1.4.1
What's Changed
- Add embedding struct support by @haimkastner in #38
- Improve error of alias validation input by @haimkastner in #38
- Fixed several fields with types from external packages issues by @yuval-po in #39
- Fix OpenAPI 3.0 models description when used as other struct field type by @haimkastner in #39
Full Changelog: v1.4.0...v1.4.1