Skip to content

Releases: gopher-fleece/gleece

New `dump graph` command

08 Jan 18:25
44c28c5

Choose a tag to compare

What's Changed

Full Changelog: v2.0.0...v2.1.0

v2.0.0

24 Dec 23:33
1b610d6

Choose a tag to compare

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 like map[string]something.Something would 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, bool and int)

    Below you can see a graphical dump of a controller with generics in use:

    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 the commonConfig section of your Gleece Config file, 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 ApiValidator as the entry point to the HIR validation subsystem.

    This currently includes a URL conflict detection algorithm to emit diagnostics upon route conflicts such as between POST /a/b/c and POST /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 any yielded an object schema entity rather than a 'map-like' one, i.e.,

 "someField": {
	"additionalProperties": {
    	"type": "object"
	},
	"type": "object"
}

v1.5.4

15 Oct 16:37
9c7a058

Choose a tag to compare

What's Changed

Full Changelog: v1.5.3...v1.5.4

v1.5.3

11 Jul 12:11

Choose a tag to compare

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

10 Jul 23:09

Choose a tag to compare

What's Changed

Full Changelog: v1.5.1...v1.5.2

v1.5.1

26 Jun 10:09
8177035

Choose a tag to compare

What's Changed

Full Changelog: v1.5.0...v1.5.1

v1.5.0

28 May 07:32
5162052

Choose a tag to compare

What's Changed

Full Changelog: v1.4.4...v1.5.0

v1.4.4

23 May 14:06
fe1b662

Choose a tag to compare

What's Changed

Full Changelog: v1.4.3...v1.4.4

v1.4.3

13 May 07:18
aa5e9b1

Choose a tag to compare

What's Changed

Full Changelog: v1.4.1...v1.4.3

v1.4.1

30 Mar 12:57

Choose a tag to compare

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