wI2L / fizz

:lemon: Gin wrapper with OpenAPI 3 spec generation
https://pkg.go.dev/github.com/wI2L/fizz
MIT License
214 stars 52 forks source link

Nullable enum fields #92

Closed lukap3 closed 2 years ago

lukap3 commented 2 years ago

Defining an optional (pointer) enum field results in an error:

type Param struct {
    EnumParam *string `query:"enumParam" enum:"a,b" example:"a" default:"a" description:"Enum parameter"`
}

enum value a cannot be converted to field type: unknown type *string: field=enumParam, type=

Since nullable enum fields are viable, this PR adds support for them

codecov[bot] commented 2 years ago

Codecov Report

Merging #92 (e55975b) into master (98d467d) will decrease coverage by 0.00%. The diff coverage is n/a.

@@            Coverage Diff             @@
##           master      #92      +/-   ##
==========================================
- Coverage   94.38%   94.37%   -0.01%     
==========================================
  Files           7        7              
  Lines         979      978       -1     
==========================================
- Hits          924      923       -1     
  Misses         39       39              
  Partials       16       16              
Impacted Files Coverage Δ
openapi/generator.go 93.93% <ø> (-0.01%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

lukap3 commented 2 years ago

@wI2L any more concerns about this PR?

wI2L commented 2 years ago

@lukap3 Not, it's fine. Not a fan of the test run names that reflect the field being tested, but i'll pass on that.