Response payload names and comments#28
Merged
deepmap-marcinr merged 3 commits intooapi-codegen:masterfrom Jun 13, 2019
chrusty:response_payload_names
Merged
Response payload names and comments#28deepmap-marcinr merged 3 commits intooapi-codegen:masterfrom chrusty:response_payload_names
deepmap-marcinr merged 3 commits intooapi-codegen:masterfrom
chrusty:response_payload_names
Conversation
Contributor
chrusty
commented
Jun 13, 2019
- Removed comments from generated types (they weren't always populated, plus they could have unsafe characters)
- Changed the name of the generated response structs (prefixed with "OAPI"), to make them less likely to clash with user-defined model names
Contributor
deepmap-marcinr
left a comment
There was a problem hiding this comment.
What do you think about not using named types for these responses?
Contributor
|
That sounds like a good idea.
…On Thu, Jun 13, 2019 at 1:12 PM Prawn ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In examples/petstore-expanded/api/petstore-client.gen.go
<#28 (comment)>:
> @@ -124,44 +124,44 @@ func NewClientWithResponses(server string) *ClientWithResponses {
}
}
-// FindPetsResponse is returned by Client.FindPets()
-type FindPetsResponse struct {
+// OAPIFindPetsResponse is returned by Client.FindPets()
+type OAPIFindPetsResponse struct {
I agree that it is kinda gross, but the anonymous structs are not going to
look pretty either. Also how would we deal with the StatusCode() and
Status() methods?
What if we keep the response structs with their previous names, but make
them private? That way they'll never clash with the generated schema models.
Does that work?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#28>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALKC5DCDNCGCZYGTHNS6O2LP2KS2BANCNFSM4HX2YY5A>
.
|
Contributor
Author
|
Alright, that looks like it works. |
adrianpk
pushed a commit
to foorester/oapi-codegen
that referenced
this pull request
Jan 16, 2024
* Removed comments from generated types (not always pretty or safe) * Changed the name of the generated responses (prefixing with OAPI) * Using private response structs (less ugly, and guaranteed to avoid clashes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.