Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom annotations for bundle-specific JSON schema fields #1957
Custom annotations for bundle-specific JSON schema fields #1957
Changes from 6 commits
9b588c0
12c4373
049e11b
8016d41
0221c28
a3fdc8d
79a88e9
c3d049f
b076813
073aeca
a6c45d5
d164968
00164a8
a579b1c
e15107f
9a55037
16042b5
0171513
d2bfb67
8f59695
40505b8
d3b30f7
43c4b58
aed0e0a
5194889
8a33fb3
6bc9664
1b31c09
7fb1ed8
9f3ec3d
3231cff
c619a73
3049184
0037671
7d8ae48
34d7484
386c7d3
835fb05
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
yamlsaver
for saving to disk.This gives you some control over the node style if you need it (e.g. use blocks for all descriptions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to
yamlsaver
withyaml.LiteralStyle
to make editing easier, this style seems the best for this purposeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather keep
typePath
a private method because it deals with how to serialize#ref
and work with the way our OpenAPI spec is structured.We can instead directly use
typ.PkgPath() + "." + typ.Name()
here and error if either of them is an empty string. The rationale being that the annotations override will only be applicable for Go structs and not other types like primitive strings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of the map is a value type, so
item
will already be zero-initialized if it doesn't exist.The
if !ok
is not needed.