Closed metaleap closed 6 months ago
OK found a workaround via:
myreflo.JSONSchemaReflector().DefaultOptions = append(myreflo.JSONSchemaReflector().DefaultOptions, jsonschema.ProcessWithoutTags)
Guess that closes this Issue (your call! =), though this progress now has me stuck on #91 ...
Thank you for raising this issue, tagless JSON behavior is indeed important aspect. And unfortunately might be not smooth enough in this library.
One of the potential problems (as far as I remember, did not check the code on this) is that in some places there are checks like hasJSONFields
based on the presence of json
tags which guides decision on whether the structure should be treated as JSON or a form data. This is not a blocker, but it may need some logic re implementation to properly support tagless JSON.
Please feel free to share more issues/details on your experience with tagless approach, it would be very useful to inform proper implementation.
Ah, in that case, might be best to "capture them" earliest right during the first struct reflect
ion, ie. adding the implied-by-its-absence "default tag" at runtime as if it was explicitly there, iif it indeed wasn't. (Perhaps behind an option if preferred.)
Done in #93.
Glad this exists and is in such mature shape!
Would you be open to (implementing, or a PR implementing) support for
json:
-tag-less struct fields for request/response structs?There are surely a few
encoding/json
users other than me out there who are quite fine with the standard upper-case naming beingMarshal
ed for exported fields withoutjson:
tags, and don't need or want to ensure the more-common "js(on) field camelCasing aesthetic", and don't want to busy themselves with the endless chore of field-tag maintenance (linter-assisted or not).Right now, for
openapi31
to emit something (that shows up in the swagger-ui-ish rendition of editor-next.swagger.io) for one'sAddReqStructure
/AddRespStructure
calls, those tags are necessary — imho unnecessarily.