Closed nikicc closed 3 years ago
Merging #56 (ab1b50d) into master (6c2edb3) will increase coverage by
0.55%
. The diff coverage is85.18%
.
@@ Coverage Diff @@
## master #56 +/- ##
==========================================
+ Coverage 95.33% 95.88% +0.55%
==========================================
Files 7 7
Lines 900 924 +24
==========================================
+ Hits 858 886 +28
+ Misses 27 22 -5
- Partials 15 16 +1
Impacted Files | Coverage Δ | |
---|---|---|
openapi/generator.go | 94.39% <84.61%> (+0.54%) |
:arrow_up: |
openapi/types.go | 100.00% <100.00%> (+2.81%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 6c2edb3...ab1b50d. Read the comment docs.
@nikicc Thanks for the PR, I'm in favor of that fix.
However, I noticed that it was lacking support for pointer-chain fields, such as **bool
or ***string
...
I hijacked your PR and pushed a new commit to fix the current codebase where that support was missing, and added new tests.
(I fixed some linting issues, unrelated to that current patch, don't mind it please, I wasn't keen to create another PR just for those changes, so I included them while I can).
Please, don't hesitate to comment and/or give a feddback on my changes.
@wI2L great, will check.
I am looking into it to add more tests cases.
@wI2L as far as I'm concerned, this can go in. Do you have something else you want to add or can we merge?
The issue
Currently, the
example
tag will not work for fields that are pointers to other types. For example, for this struct:the
valA
will be present in the generated spec, whilevalB
will not.Reasoning
As having pointers to other types is the simplest solution to get
null
values in the JSON responses for missing data (instead of the Go defaults for the corresponding type), I think theexample
tag should also work for pointers.Proposed solution
When parsing the
example
tag values, if we get a pointer, try to parse the value that pointer points to.