Skip to content

v1.6.0

Compare
Choose a tag to compare
@github-actions github-actions released this 29 Oct 07:54
· 5 commits to main since this release
3b6d7ce

Highlights

Support generating generic type parameters and ignore unexported fields in the struct:

type GetCustomHeadersArguments[T any, S int | int8 | int16 | int32 | int64] struct {
	Headers map[string]string                   `json:"headers"`
	Input   *T                                                  `json:"input"`
	Other   *GetCustomHeadersOther[S] `json:"other"`
}

type GetCustomHeadersOther[T int | int8 | int16 | int32 | int64] struct {
	Value T `json:"value"`
}

type GetCustomHeadersResult[T any, O int | int8 | int16 | int32 | int64] struct {
	Headers  map[string]string `json:"headers"`
	Response T
	Other    *GetCustomHeadersOther[O] `json:"other"`
}

func FunctionGetCustomHeaders(ctx context.Context, state *types.State, arguments *GetCustomHeadersArguments[BaseAuthor, int]) (GetCustomHeadersResult[HelloResult, int64], error) {
    // ...
}

Support options of the json tag:

  • omitempty: if this option is set, the field schema will be nullable even if the field type isn't a pointer.
  • - the object field is ignored.
type SomeObject struct {
  Headers map[string]string `json:"omitempty"`
  IgnoredField string `json:"-"`
}

What's Changed

  • utils: Expose reflection decode utilities by @hgiasac in #156
  • utils: fix non-null return types for decoding utilities and improve linter by @hgiasac in #157
  • cli: support generating generic type parameters by @hgiasac in #158
  • cli: support omitempty and ignore - json tags by @hgiasac in #159
  • utils: add environment value utilities by @hgiasac in #161
  • utils: add Duration scalar by @hgiasac in #162
  • utils: use the ParseDuration function of prometheus model by @hgiasac in #163
  • cli: improve generic decoders and type generation by @hgiasac in #164

Full Changelog: v1.5.1...v1.6.0