From f315a120205953fbc11808555700700b08cfc26b Mon Sep 17 00:00:00 2001 From: Phil Bugdahn Date: Thu, 11 Jul 2024 15:49:22 -0400 Subject: [PATCH 1/5] [GoServer] Generate non-required parameters as pointers (nil-able) --- .../openapitools/codegen/languages/GoServerCodegen.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java index d38c62e5b2b5..c29170841a8f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java @@ -182,6 +182,15 @@ public GoServerCodegen() { ); } + @Override + public void postProcessParameter(CodegenParameter parameter) { + super.postProcessParameter(parameter); + + if (!parameter.required) { + parameter.dataType = "*" + parameter.dataType; + } + } + @Override public void processOpts() { super.processOpts(); From 00cdce2285f0bdc369223965b6cce0076899ac29 Mon Sep 17 00:00:00 2001 From: Phil Bugdahn Date: Fri, 12 Jul 2024 08:55:46 -0400 Subject: [PATCH 2/5] Regenerated samples --- .../server/petstore/go/go-petstore/go/api.go | 11 ++++----- .../petstore/go/go-petstore/go/api_pet.go | 1 - .../go/go-petstore/go/api_pet_service.go | 7 +++--- .../go/go-petstore/go/api_user_service.go | 4 ++-- .../server/petstore/go-api-server/go/api.go | 23 +++++++++---------- .../petstore/go-api-server/go/api_pet.go | 9 ++++---- .../go-api-server/go/api_pet_service.go | 19 ++++++++------- .../go-api-server/go/api_user_service.go | 4 ++-- .../server/petstore/go-chi-server/go/api.go | 23 +++++++++---------- .../petstore/go-chi-server/go/api_pet.go | 9 ++++---- .../go-chi-server/go/api_pet_service.go | 19 ++++++++------- .../go-chi-server/go/api_user_service.go | 4 ++-- 12 files changed, 62 insertions(+), 71 deletions(-) diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api.go b/samples/openapi3/server/petstore/go/go-petstore/go/api.go index 9fdfee3fcefd..92984d32f53a 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api.go @@ -13,7 +13,6 @@ package petstoreserver import ( "context" "net/http" - "os" ) @@ -62,14 +61,14 @@ type UserAPIRouter interface { // and updated with the logic required for the API. type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) - DeletePet(context.Context, int64, string) (ImplResponse, error) + DeletePet(context.Context, int64, *string) (ImplResponse, error) FindPetsByStatus(context.Context, []string) (ImplResponse, error) // Deprecated FindPetsByTags(context.Context, []string) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) - UpdatePetWithForm(context.Context, int64, string, string) (ImplResponse, error) - UploadFile(context.Context, int64, string, *os.File) (ImplResponse, error) + UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) + UploadFile(context.Context, int64, *string, **os.File) (ImplResponse, error) } @@ -93,9 +92,9 @@ type UserAPIServicer interface { CreateUser(context.Context, User) (ImplResponse, error) CreateUsersWithArrayInput(context.Context, []User) (ImplResponse, error) CreateUsersWithListInput(context.Context, []User) (ImplResponse, error) - DeleteUser(context.Context, string, bool) (ImplResponse, error) + DeleteUser(context.Context, string, *bool) (ImplResponse, error) GetUserByName(context.Context, string) (ImplResponse, error) - LoginUser(context.Context, string, string, int32, int64, float32, float64, bool) (ImplResponse, error) + LoginUser(context.Context, string, string, *int32, *int64, *float32, *float64, *bool) (ImplResponse, error) LogoutUser(context.Context) (ImplResponse, error) UpdateUser(context.Context, string, User) (ImplResponse, error) } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go index 5b043ad51bcd..99f804736792 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go @@ -14,7 +14,6 @@ import ( "encoding/json" "net/http" "strings" - "os" "github.com/go-chi/chi/v5" ) diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go index cea78ae519a5..0e0dfed50d62 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go @@ -14,7 +14,6 @@ import ( "context" "net/http" "errors" - "os" ) // PetAPIService is a service that implements the logic for the PetAPIServicer @@ -43,7 +42,7 @@ func (s *PetAPIService) AddPet(ctx context.Context, pet Pet) (ImplResponse, erro } // DeletePet - Deletes a pet -func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey string) (ImplResponse, error) { +func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *string) (ImplResponse, error) { // TODO - update DeletePet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -120,7 +119,7 @@ func (s *PetAPIService) UpdatePet(ctx context.Context, pet Pet) (ImplResponse, e } // UpdatePetWithForm - Updates a pet in the store with form data -func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name string, status string) (ImplResponse, error) { +func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name *string, status *string) (ImplResponse, error) { // TODO - update UpdatePetWithForm with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -131,7 +130,7 @@ func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name } // UploadFile - uploads an image -func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata string, file *os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata *string, file **os.File) (ImplResponse, error) { // TODO - update UploadFile with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go index 4be92131dc0b..887efe3b6723 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go @@ -61,7 +61,7 @@ func (s *UserAPIService) CreateUsersWithListInput(ctx context.Context, user []Us } // DeleteUser - Delete user -func (s *UserAPIService) DeleteUser(ctx context.Context, username string, booleanTest bool) (ImplResponse, error) { +func (s *UserAPIService) DeleteUser(ctx context.Context, username string, booleanTest *bool) (ImplResponse, error) { // TODO - update DeleteUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -92,7 +92,7 @@ func (s *UserAPIService) GetUserByName(ctx context.Context, username string) (Im } // LoginUser - Logs user into the system -func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, int32Test int32, int64Test int64, float32Test float32, float64Test float64, booleanTest bool) (ImplResponse, error) { +func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, int32Test *int32, int64Test *int64, float32Test *float32, float64Test *float64, booleanTest *bool) (ImplResponse, error) { // TODO - update LoginUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-api-server/go/api.go b/samples/server/petstore/go-api-server/go/api.go index 23d5213c5a63..63b6e6a27411 100644 --- a/samples/server/petstore/go-api-server/go/api.go +++ b/samples/server/petstore/go-api-server/go/api.go @@ -14,7 +14,6 @@ import ( "context" "net/http" "time" - "os" ) @@ -69,20 +68,20 @@ type UserAPIRouter interface { // and updated with the logic required for the API. type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) - DeletePet(context.Context, int64, string) (ImplResponse, error) - FilterPetsByCategory(context.Context, Gender, Species, []Species) (ImplResponse, error) - FindPetsByStatus(context.Context, []string, string, string, int32, float32, string) (ImplResponse, error) + DeletePet(context.Context, int64, *string) (ImplResponse, error) + FilterPetsByCategory(context.Context, Gender, Species, *[]Species) (ImplResponse, error) + FindPetsByStatus(context.Context, []string, *string, *string, *int32, *float32, *string) (ImplResponse, error) // Deprecated - FindPetsByTags(context.Context, []string, time.Time, time.Time, Colour) (ImplResponse, error) + FindPetsByTags(context.Context, []string, time.Time, *time.Time, *Colour) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) GetPetImageById(context.Context, int64) (ImplResponse, error) GetPetsByTime(context.Context, time.Time) (ImplResponse, error) - GetPetsUsingBooleanQueryParameters(context.Context, bool, bool, bool) (ImplResponse, error) - SearchPet(context.Context, *int64, *float32, *time.Time, *bool) (ImplResponse, error) + GetPetsUsingBooleanQueryParameters(context.Context, bool, *bool, *bool) (ImplResponse, error) + SearchPet(context.Context, **int64, **float32, **time.Time, **bool) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) - UpdatePetWithForm(context.Context, int64, string, string) (ImplResponse, error) - UploadFile(context.Context, int64, string, []string, *os.File) (ImplResponse, error) - UploadFileArrayOfFiles(context.Context, int64, string, []*os.File) (ImplResponse, error) + UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) + UploadFile(context.Context, int64, *string, *[]string, **os.File) (ImplResponse, error) + UploadFileArrayOfFiles(context.Context, int64, *string, *[]*os.File) (ImplResponse, error) } @@ -106,9 +105,9 @@ type UserAPIServicer interface { CreateUser(context.Context, User) (ImplResponse, error) CreateUsersWithArrayInput(context.Context, []User) (ImplResponse, error) CreateUsersWithListInput(context.Context, []User) (ImplResponse, error) - DeleteUser(context.Context, string, bool) (ImplResponse, error) + DeleteUser(context.Context, string, *bool) (ImplResponse, error) GetUserByName(context.Context, string) (ImplResponse, error) - LoginUser(context.Context, string, string, bool) (ImplResponse, error) + LoginUser(context.Context, string, string, *bool) (ImplResponse, error) LogoutUser(context.Context) (ImplResponse, error) UpdateUser(context.Context, string, User) (ImplResponse, error) } diff --git a/samples/server/petstore/go-api-server/go/api_pet.go b/samples/server/petstore/go-api-server/go/api_pet.go index 8451d4cf8922..9a75dbf5e97e 100644 --- a/samples/server/petstore/go-api-server/go/api_pet.go +++ b/samples/server/petstore/go-api-server/go/api_pet.go @@ -15,7 +15,6 @@ import ( "net/http" "strings" "time" - "os" "github.com/gorilla/mux" ) @@ -237,7 +236,7 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque c.errorHandler(w, r, &RequiredError{"inlineEnumPath"}, nil) return } - var inlineEnumParam string + var inlineEnumParam *string if query.Has("inlineEnum") { param := query.Get("inlineEnum") @@ -276,7 +275,7 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque var param float32 = 1.5 defaultNumParam = param } - var defaultStrParam string + var defaultStrParam *string if query.Has("defaultStr") { param := query.Get("defaultStr") @@ -331,9 +330,9 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request bornBeforeParam = param } else { } - var colourParam Colour + var colourParam *Colour if query.Has("colour") { - param := Colour(query.Get("colour")) + param := *Colour(query.Get("colour")) colourParam = param } else { diff --git a/samples/server/petstore/go-api-server/go/api_pet_service.go b/samples/server/petstore/go-api-server/go/api_pet_service.go index 9786bd5f71ab..a1796417d619 100644 --- a/samples/server/petstore/go-api-server/go/api_pet_service.go +++ b/samples/server/petstore/go-api-server/go/api_pet_service.go @@ -15,7 +15,6 @@ import ( "net/http" "errors" "time" - "os" ) // PetAPIService is a service that implements the logic for the PetAPIServicer @@ -44,7 +43,7 @@ func (s *PetAPIService) AddPet(ctx context.Context, pet Pet) (ImplResponse, erro } // DeletePet - Deletes a pet -func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey string) (ImplResponse, error) { +func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *string) (ImplResponse, error) { // TODO - update DeletePet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -55,7 +54,7 @@ func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey strin } // FilterPetsByCategory - Finds Pets -func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies []Species) (ImplResponse, error) { +func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies *[]Species) (ImplResponse, error) { // TODO - update FilterPetsByCategory with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -69,7 +68,7 @@ func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, } // FindPetsByStatus - Finds Pets by status -func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum string, defaultInt int32, defaultNum float32, defaultStr string) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath *string, inlineEnum *string, defaultInt *int32, defaultNum *float32, defaultStr *string) (ImplResponse, error) { // TODO - update FindPetsByStatus with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -84,7 +83,7 @@ func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, i // FindPetsByTags - Finds Pets by tags // Deprecated -func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore time.Time, colour Colour) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore *time.Time, colour *Colour) (ImplResponse, error) { // TODO - update FindPetsByTags with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -143,7 +142,7 @@ func (s *PetAPIService) GetPetsByTime(ctx context.Context, createdTime time.Time } // GetPetsUsingBooleanQueryParameters - Get the pets by only using boolean query parameters -func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, expr bool, grouping bool, inactive bool) (ImplResponse, error) { +func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, expr bool, grouping *bool, inactive *bool) (ImplResponse, error) { // TODO - update GetPetsUsingBooleanQueryParameters with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -154,7 +153,7 @@ func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, } // SearchPet - Search Pets by filters -func (s *PetAPIService) SearchPet(ctx context.Context, age *int64, price *float32, bornAfter *time.Time, old *bool) (ImplResponse, error) { +func (s *PetAPIService) SearchPet(ctx context.Context, age **int64, price **float32, bornAfter **time.Time, old **bool) (ImplResponse, error) { // TODO - update SearchPet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -185,7 +184,7 @@ func (s *PetAPIService) UpdatePet(ctx context.Context, pet Pet) (ImplResponse, e } // UpdatePetWithForm - Updates a pet in the store with form data -func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name string, status string) (ImplResponse, error) { +func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name *string, status *string) (ImplResponse, error) { // TODO - update UpdatePetWithForm with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -196,7 +195,7 @@ func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name } // UploadFile - uploads an image -func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata string, extraOptionalMetadata []string, file *os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata *string, extraOptionalMetadata *[]string, file **os.File) (ImplResponse, error) { // TODO - update UploadFile with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -207,7 +206,7 @@ func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalM } // UploadFileArrayOfFiles - uploads images (array of files) -func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata string, files []*os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata *string, files *[]*os.File) (ImplResponse, error) { // TODO - update UploadFileArrayOfFiles with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-api-server/go/api_user_service.go b/samples/server/petstore/go-api-server/go/api_user_service.go index 62332a09da48..1b3631f787bd 100644 --- a/samples/server/petstore/go-api-server/go/api_user_service.go +++ b/samples/server/petstore/go-api-server/go/api_user_service.go @@ -61,7 +61,7 @@ func (s *UserAPIService) CreateUsersWithListInput(ctx context.Context, user []Us } // DeleteUser - Delete user -func (s *UserAPIService) DeleteUser(ctx context.Context, username string, confirmation bool) (ImplResponse, error) { +func (s *UserAPIService) DeleteUser(ctx context.Context, username string, confirmation *bool) (ImplResponse, error) { // TODO - update DeleteUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -92,7 +92,7 @@ func (s *UserAPIService) GetUserByName(ctx context.Context, username string) (Im } // LoginUser - Logs user into the system -func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, rememberMe bool) (ImplResponse, error) { +func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, rememberMe *bool) (ImplResponse, error) { // TODO - update LoginUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-chi-server/go/api.go b/samples/server/petstore/go-chi-server/go/api.go index 23d5213c5a63..63b6e6a27411 100644 --- a/samples/server/petstore/go-chi-server/go/api.go +++ b/samples/server/petstore/go-chi-server/go/api.go @@ -14,7 +14,6 @@ import ( "context" "net/http" "time" - "os" ) @@ -69,20 +68,20 @@ type UserAPIRouter interface { // and updated with the logic required for the API. type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) - DeletePet(context.Context, int64, string) (ImplResponse, error) - FilterPetsByCategory(context.Context, Gender, Species, []Species) (ImplResponse, error) - FindPetsByStatus(context.Context, []string, string, string, int32, float32, string) (ImplResponse, error) + DeletePet(context.Context, int64, *string) (ImplResponse, error) + FilterPetsByCategory(context.Context, Gender, Species, *[]Species) (ImplResponse, error) + FindPetsByStatus(context.Context, []string, *string, *string, *int32, *float32, *string) (ImplResponse, error) // Deprecated - FindPetsByTags(context.Context, []string, time.Time, time.Time, Colour) (ImplResponse, error) + FindPetsByTags(context.Context, []string, time.Time, *time.Time, *Colour) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) GetPetImageById(context.Context, int64) (ImplResponse, error) GetPetsByTime(context.Context, time.Time) (ImplResponse, error) - GetPetsUsingBooleanQueryParameters(context.Context, bool, bool, bool) (ImplResponse, error) - SearchPet(context.Context, *int64, *float32, *time.Time, *bool) (ImplResponse, error) + GetPetsUsingBooleanQueryParameters(context.Context, bool, *bool, *bool) (ImplResponse, error) + SearchPet(context.Context, **int64, **float32, **time.Time, **bool) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) - UpdatePetWithForm(context.Context, int64, string, string) (ImplResponse, error) - UploadFile(context.Context, int64, string, []string, *os.File) (ImplResponse, error) - UploadFileArrayOfFiles(context.Context, int64, string, []*os.File) (ImplResponse, error) + UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) + UploadFile(context.Context, int64, *string, *[]string, **os.File) (ImplResponse, error) + UploadFileArrayOfFiles(context.Context, int64, *string, *[]*os.File) (ImplResponse, error) } @@ -106,9 +105,9 @@ type UserAPIServicer interface { CreateUser(context.Context, User) (ImplResponse, error) CreateUsersWithArrayInput(context.Context, []User) (ImplResponse, error) CreateUsersWithListInput(context.Context, []User) (ImplResponse, error) - DeleteUser(context.Context, string, bool) (ImplResponse, error) + DeleteUser(context.Context, string, *bool) (ImplResponse, error) GetUserByName(context.Context, string) (ImplResponse, error) - LoginUser(context.Context, string, string, bool) (ImplResponse, error) + LoginUser(context.Context, string, string, *bool) (ImplResponse, error) LogoutUser(context.Context) (ImplResponse, error) UpdateUser(context.Context, string, User) (ImplResponse, error) } diff --git a/samples/server/petstore/go-chi-server/go/api_pet.go b/samples/server/petstore/go-chi-server/go/api_pet.go index a4b5448a0686..35984b611534 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet.go +++ b/samples/server/petstore/go-chi-server/go/api_pet.go @@ -15,7 +15,6 @@ import ( "net/http" "strings" "time" - "os" "github.com/go-chi/chi/v5" ) @@ -234,7 +233,7 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque c.errorHandler(w, r, &RequiredError{"inlineEnumPath"}, nil) return } - var inlineEnumParam string + var inlineEnumParam *string if query.Has("inlineEnum") { param := query.Get("inlineEnum") @@ -273,7 +272,7 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque var param float32 = 1.5 defaultNumParam = param } - var defaultStrParam string + var defaultStrParam *string if query.Has("defaultStr") { param := query.Get("defaultStr") @@ -328,9 +327,9 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request bornBeforeParam = param } else { } - var colourParam Colour + var colourParam *Colour if query.Has("colour") { - param := Colour(query.Get("colour")) + param := *Colour(query.Get("colour")) colourParam = param } else { diff --git a/samples/server/petstore/go-chi-server/go/api_pet_service.go b/samples/server/petstore/go-chi-server/go/api_pet_service.go index 9786bd5f71ab..a1796417d619 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet_service.go +++ b/samples/server/petstore/go-chi-server/go/api_pet_service.go @@ -15,7 +15,6 @@ import ( "net/http" "errors" "time" - "os" ) // PetAPIService is a service that implements the logic for the PetAPIServicer @@ -44,7 +43,7 @@ func (s *PetAPIService) AddPet(ctx context.Context, pet Pet) (ImplResponse, erro } // DeletePet - Deletes a pet -func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey string) (ImplResponse, error) { +func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *string) (ImplResponse, error) { // TODO - update DeletePet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -55,7 +54,7 @@ func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey strin } // FilterPetsByCategory - Finds Pets -func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies []Species) (ImplResponse, error) { +func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies *[]Species) (ImplResponse, error) { // TODO - update FilterPetsByCategory with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -69,7 +68,7 @@ func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, } // FindPetsByStatus - Finds Pets by status -func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum string, defaultInt int32, defaultNum float32, defaultStr string) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath *string, inlineEnum *string, defaultInt *int32, defaultNum *float32, defaultStr *string) (ImplResponse, error) { // TODO - update FindPetsByStatus with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -84,7 +83,7 @@ func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, i // FindPetsByTags - Finds Pets by tags // Deprecated -func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore time.Time, colour Colour) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore *time.Time, colour *Colour) (ImplResponse, error) { // TODO - update FindPetsByTags with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -143,7 +142,7 @@ func (s *PetAPIService) GetPetsByTime(ctx context.Context, createdTime time.Time } // GetPetsUsingBooleanQueryParameters - Get the pets by only using boolean query parameters -func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, expr bool, grouping bool, inactive bool) (ImplResponse, error) { +func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, expr bool, grouping *bool, inactive *bool) (ImplResponse, error) { // TODO - update GetPetsUsingBooleanQueryParameters with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -154,7 +153,7 @@ func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, } // SearchPet - Search Pets by filters -func (s *PetAPIService) SearchPet(ctx context.Context, age *int64, price *float32, bornAfter *time.Time, old *bool) (ImplResponse, error) { +func (s *PetAPIService) SearchPet(ctx context.Context, age **int64, price **float32, bornAfter **time.Time, old **bool) (ImplResponse, error) { // TODO - update SearchPet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -185,7 +184,7 @@ func (s *PetAPIService) UpdatePet(ctx context.Context, pet Pet) (ImplResponse, e } // UpdatePetWithForm - Updates a pet in the store with form data -func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name string, status string) (ImplResponse, error) { +func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name *string, status *string) (ImplResponse, error) { // TODO - update UpdatePetWithForm with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -196,7 +195,7 @@ func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name } // UploadFile - uploads an image -func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata string, extraOptionalMetadata []string, file *os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata *string, extraOptionalMetadata *[]string, file **os.File) (ImplResponse, error) { // TODO - update UploadFile with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -207,7 +206,7 @@ func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalM } // UploadFileArrayOfFiles - uploads images (array of files) -func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata string, files []*os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata *string, files *[]*os.File) (ImplResponse, error) { // TODO - update UploadFileArrayOfFiles with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-chi-server/go/api_user_service.go b/samples/server/petstore/go-chi-server/go/api_user_service.go index 62332a09da48..1b3631f787bd 100644 --- a/samples/server/petstore/go-chi-server/go/api_user_service.go +++ b/samples/server/petstore/go-chi-server/go/api_user_service.go @@ -61,7 +61,7 @@ func (s *UserAPIService) CreateUsersWithListInput(ctx context.Context, user []Us } // DeleteUser - Delete user -func (s *UserAPIService) DeleteUser(ctx context.Context, username string, confirmation bool) (ImplResponse, error) { +func (s *UserAPIService) DeleteUser(ctx context.Context, username string, confirmation *bool) (ImplResponse, error) { // TODO - update DeleteUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -92,7 +92,7 @@ func (s *UserAPIService) GetUserByName(ctx context.Context, username string) (Im } // LoginUser - Logs user into the system -func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, rememberMe bool) (ImplResponse, error) { +func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, rememberMe *bool) (ImplResponse, error) { // TODO - update LoginUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. From 0d80919774ff29e4c0508a20b609916ce77a3701 Mon Sep 17 00:00:00 2001 From: Phil Bugdahn Date: Fri, 12 Jul 2024 12:07:56 -0400 Subject: [PATCH 3/5] Set non-required parameters to nullable --- .../org/openapitools/codegen/languages/GoServerCodegen.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java index c29170841a8f..ad8ce829bee7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java @@ -186,9 +186,7 @@ public GoServerCodegen() { public void postProcessParameter(CodegenParameter parameter) { super.postProcessParameter(parameter); - if (!parameter.required) { - parameter.dataType = "*" + parameter.dataType; - } + parameter.isNullable = parameter.notRequiredOrIsNullable(); } @Override From adaac416ba3ea27bb958580fc6184cba17969ef3 Mon Sep 17 00:00:00 2001 From: Phil Bugdahn Date: Mon, 15 Jul 2024 09:18:26 -0400 Subject: [PATCH 4/5] Generated samples --- .../server/petstore/go/go-petstore/go/api.go | 1 + .../petstore/go/go-petstore/go/api_pet.go | 1 + .../go/go-petstore/go/api_pet_service.go | 1 + .../petstore/go/go-petstore/go/api_user.go | 24 ++++++------ .../server/petstore/go-api-server/go/api.go | 3 +- .../petstore/go-api-server/go/api_pet.go | 37 ++++++++++--------- .../go-api-server/go/api_pet_service.go | 3 +- .../petstore/go-api-server/go/api_user.go | 8 ++-- .../server/petstore/go-chi-server/go/api.go | 3 +- .../petstore/go-chi-server/go/api_pet.go | 37 ++++++++++--------- .../go-chi-server/go/api_pet_service.go | 3 +- .../petstore/go-chi-server/go/api_user.go | 8 ++-- 12 files changed, 69 insertions(+), 60 deletions(-) diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api.go b/samples/openapi3/server/petstore/go/go-petstore/go/api.go index 92984d32f53a..bca741e85cb6 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api.go @@ -13,6 +13,7 @@ package petstoreserver import ( "context" "net/http" + "os" ) diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go index 99f804736792..5b043ad51bcd 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go @@ -14,6 +14,7 @@ import ( "encoding/json" "net/http" "strings" + "os" "github.com/go-chi/chi/v5" ) diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go index 0e0dfed50d62..8cc2b381e6d6 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go @@ -14,6 +14,7 @@ import ( "context" "net/http" "errors" + "os" ) // PetAPIService is a service that implements the logic for the PetAPIServicer diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go index 1d28ab73b753..ae865f1c4426 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go @@ -183,7 +183,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{"username"}, nil) return } - var booleanTestParam bool + var booleanTestParam *bool if query.Has("boolean_test") { param, err := parseBoolParameter( query.Get("boolean_test"), @@ -194,7 +194,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { return } - booleanTestParam = param + booleanTestParam = ¶m } else { } result, err := c.service.DeleteUser(r.Context(), usernameParam, booleanTestParam) @@ -249,7 +249,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{Field: "password"}, nil) return } - var int32TestParam int32 + var int32TestParam *int32 if query.Has("int32_test") { param, err := parseNumericParameter[int32]( query.Get("int32_test"), @@ -260,10 +260,10 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } - int32TestParam = param + int32TestParam = ¶m } else { } - var int64TestParam int64 + var int64TestParam *int64 if query.Has("int64_test") { param, err := parseNumericParameter[int64]( query.Get("int64_test"), @@ -274,10 +274,10 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } - int64TestParam = param + int64TestParam = ¶m } else { } - var float32TestParam float32 + var float32TestParam *float32 if query.Has("float32_test") { param, err := parseNumericParameter[float32]( query.Get("float32_test"), @@ -288,10 +288,10 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } - float32TestParam = param + float32TestParam = ¶m } else { } - var float64TestParam float64 + var float64TestParam *float64 if query.Has("float64_test") { param, err := parseNumericParameter[float64]( query.Get("float64_test"), @@ -302,10 +302,10 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } - float64TestParam = param + float64TestParam = ¶m } else { } - var booleanTestParam bool + var booleanTestParam *bool if query.Has("boolean_test") { param, err := parseBoolParameter( query.Get("boolean_test"), @@ -316,7 +316,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } - booleanTestParam = param + booleanTestParam = ¶m } else { } result, err := c.service.LoginUser(r.Context(), usernameParam, passwordParam, int32TestParam, int64TestParam, float32TestParam, float64TestParam, booleanTestParam) diff --git a/samples/server/petstore/go-api-server/go/api.go b/samples/server/petstore/go-api-server/go/api.go index 63b6e6a27411..1bfbf14f645f 100644 --- a/samples/server/petstore/go-api-server/go/api.go +++ b/samples/server/petstore/go-api-server/go/api.go @@ -14,6 +14,7 @@ import ( "context" "net/http" "time" + "os" ) @@ -77,7 +78,7 @@ type PetAPIServicer interface { GetPetImageById(context.Context, int64) (ImplResponse, error) GetPetsByTime(context.Context, time.Time) (ImplResponse, error) GetPetsUsingBooleanQueryParameters(context.Context, bool, *bool, *bool) (ImplResponse, error) - SearchPet(context.Context, **int64, **float32, **time.Time, **bool) (ImplResponse, error) + SearchPet(context.Context, *int64, *float32, *time.Time, *bool) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) UploadFile(context.Context, int64, *string, *[]string, **os.File) (ImplResponse, error) diff --git a/samples/server/petstore/go-api-server/go/api_pet.go b/samples/server/petstore/go-api-server/go/api_pet.go index 9a75dbf5e97e..89e666ce6ca5 100644 --- a/samples/server/petstore/go-api-server/go/api_pet.go +++ b/samples/server/petstore/go-api-server/go/api_pet.go @@ -15,6 +15,7 @@ import ( "net/http" "strings" "time" + "os" "github.com/gorilla/mux" ) @@ -240,10 +241,10 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque if query.Has("inlineEnum") { param := query.Get("inlineEnum") - inlineEnumParam = param + inlineEnumParam = ¶m } else { } - var defaultIntParam int32 + var defaultIntParam *int32 if query.Has("defaultInt") { param, err := parseNumericParameter[int32]( query.Get("defaultInt"), @@ -254,12 +255,12 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque return } - defaultIntParam = param + defaultIntParam = ¶m } else { var param int32 = 1 - defaultIntParam = param + defaultIntParam = ¶m } - var defaultNumParam float32 + var defaultNumParam *float32 if query.Has("defaultNum") { param, err := parseNumericParameter[float32]( query.Get("defaultNum"), @@ -270,19 +271,19 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque return } - defaultNumParam = param + defaultNumParam = ¶m } else { var param float32 = 1.5 - defaultNumParam = param + defaultNumParam = ¶m } var defaultStrParam *string if query.Has("defaultStr") { param := query.Get("defaultStr") - defaultStrParam = param + defaultStrParam = ¶m } else { param := "default" - defaultStrParam = param + defaultStrParam = ¶m } result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam, defaultIntParam, defaultNumParam, defaultStrParam) // If an error occurred, encode the error with the status code @@ -319,7 +320,7 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request c.errorHandler(w, r, &RequiredError{"bornAfter"}, nil) return } - var bornBeforeParam time.Time + var bornBeforeParam *time.Time if query.Has("bornBefore"){ param, err := parseTime(query.Get("bornBefore")) if err != nil { @@ -327,14 +328,14 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request return } - bornBeforeParam = param + bornBeforeParam = ¶m } else { } var colourParam *Colour if query.Has("colour") { - param := *Colour(query.Get("colour")) + param := Colour(query.Get("colour")) - colourParam = param + colourParam = ¶m } else { } result, err := c.service.FindPetsByTags(r.Context(), tagsParam, bornAfterParam, bornBeforeParam, colourParam) @@ -430,7 +431,7 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri c.errorHandler(w, r, &RequiredError{Field: "expr"}, nil) return } - var groupingParam bool + var groupingParam *bool if query.Has("grouping") { param, err := parseBoolParameter( query.Get("grouping"), @@ -441,10 +442,10 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri return } - groupingParam = param + groupingParam = ¶m } else { } - var inactiveParam bool + var inactiveParam *bool if query.Has("inactive") { param, err := parseBoolParameter( query.Get("inactive"), @@ -455,10 +456,10 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri return } - inactiveParam = param + inactiveParam = ¶m } else { var param bool = false - inactiveParam = param + inactiveParam = ¶m } result, err := c.service.GetPetsUsingBooleanQueryParameters(r.Context(), exprParam, groupingParam, inactiveParam) // If an error occurred, encode the error with the status code diff --git a/samples/server/petstore/go-api-server/go/api_pet_service.go b/samples/server/petstore/go-api-server/go/api_pet_service.go index a1796417d619..f5d14b661946 100644 --- a/samples/server/petstore/go-api-server/go/api_pet_service.go +++ b/samples/server/petstore/go-api-server/go/api_pet_service.go @@ -15,6 +15,7 @@ import ( "net/http" "errors" "time" + "os" ) // PetAPIService is a service that implements the logic for the PetAPIServicer @@ -153,7 +154,7 @@ func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, } // SearchPet - Search Pets by filters -func (s *PetAPIService) SearchPet(ctx context.Context, age **int64, price **float32, bornAfter **time.Time, old **bool) (ImplResponse, error) { +func (s *PetAPIService) SearchPet(ctx context.Context, age *int64, price *float32, bornAfter *time.Time, old *bool) (ImplResponse, error) { // TODO - update SearchPet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-api-server/go/api_user.go b/samples/server/petstore/go-api-server/go/api_user.go index f1917fa9b785..8a96b53fd128 100644 --- a/samples/server/petstore/go-api-server/go/api_user.go +++ b/samples/server/petstore/go-api-server/go/api_user.go @@ -184,7 +184,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{"username"}, nil) return } - var confirmationParam bool + var confirmationParam *bool if query.Has("confirmation") { param, err := parseBoolParameter( query.Get("confirmation"), @@ -195,7 +195,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { return } - confirmationParam = param + confirmationParam = ¶m } else { } result, err := c.service.DeleteUser(r.Context(), usernameParam, confirmationParam) @@ -251,7 +251,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{Field: "password"}, nil) return } - var rememberMeParam bool + var rememberMeParam *bool if query.Has("remember_me") { param, err := parseBoolParameter( query.Get("remember_me"), @@ -262,7 +262,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } - rememberMeParam = param + rememberMeParam = ¶m } else { } result, err := c.service.LoginUser(r.Context(), usernameParam, passwordParam, rememberMeParam) diff --git a/samples/server/petstore/go-chi-server/go/api.go b/samples/server/petstore/go-chi-server/go/api.go index 63b6e6a27411..1bfbf14f645f 100644 --- a/samples/server/petstore/go-chi-server/go/api.go +++ b/samples/server/petstore/go-chi-server/go/api.go @@ -14,6 +14,7 @@ import ( "context" "net/http" "time" + "os" ) @@ -77,7 +78,7 @@ type PetAPIServicer interface { GetPetImageById(context.Context, int64) (ImplResponse, error) GetPetsByTime(context.Context, time.Time) (ImplResponse, error) GetPetsUsingBooleanQueryParameters(context.Context, bool, *bool, *bool) (ImplResponse, error) - SearchPet(context.Context, **int64, **float32, **time.Time, **bool) (ImplResponse, error) + SearchPet(context.Context, *int64, *float32, *time.Time, *bool) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) UploadFile(context.Context, int64, *string, *[]string, **os.File) (ImplResponse, error) diff --git a/samples/server/petstore/go-chi-server/go/api_pet.go b/samples/server/petstore/go-chi-server/go/api_pet.go index 35984b611534..75214333e503 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet.go +++ b/samples/server/petstore/go-chi-server/go/api_pet.go @@ -15,6 +15,7 @@ import ( "net/http" "strings" "time" + "os" "github.com/go-chi/chi/v5" ) @@ -237,10 +238,10 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque if query.Has("inlineEnum") { param := query.Get("inlineEnum") - inlineEnumParam = param + inlineEnumParam = ¶m } else { } - var defaultIntParam int32 + var defaultIntParam *int32 if query.Has("defaultInt") { param, err := parseNumericParameter[int32]( query.Get("defaultInt"), @@ -251,12 +252,12 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque return } - defaultIntParam = param + defaultIntParam = ¶m } else { var param int32 = 1 - defaultIntParam = param + defaultIntParam = ¶m } - var defaultNumParam float32 + var defaultNumParam *float32 if query.Has("defaultNum") { param, err := parseNumericParameter[float32]( query.Get("defaultNum"), @@ -267,19 +268,19 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque return } - defaultNumParam = param + defaultNumParam = ¶m } else { var param float32 = 1.5 - defaultNumParam = param + defaultNumParam = ¶m } var defaultStrParam *string if query.Has("defaultStr") { param := query.Get("defaultStr") - defaultStrParam = param + defaultStrParam = ¶m } else { param := "default" - defaultStrParam = param + defaultStrParam = ¶m } result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam, defaultIntParam, defaultNumParam, defaultStrParam) // If an error occurred, encode the error with the status code @@ -316,7 +317,7 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request c.errorHandler(w, r, &RequiredError{"bornAfter"}, nil) return } - var bornBeforeParam time.Time + var bornBeforeParam *time.Time if query.Has("bornBefore"){ param, err := parseTime(query.Get("bornBefore")) if err != nil { @@ -324,14 +325,14 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request return } - bornBeforeParam = param + bornBeforeParam = ¶m } else { } var colourParam *Colour if query.Has("colour") { - param := *Colour(query.Get("colour")) + param := Colour(query.Get("colour")) - colourParam = param + colourParam = ¶m } else { } result, err := c.service.FindPetsByTags(r.Context(), tagsParam, bornAfterParam, bornBeforeParam, colourParam) @@ -424,7 +425,7 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri c.errorHandler(w, r, &RequiredError{Field: "expr"}, nil) return } - var groupingParam bool + var groupingParam *bool if query.Has("grouping") { param, err := parseBoolParameter( query.Get("grouping"), @@ -435,10 +436,10 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri return } - groupingParam = param + groupingParam = ¶m } else { } - var inactiveParam bool + var inactiveParam *bool if query.Has("inactive") { param, err := parseBoolParameter( query.Get("inactive"), @@ -449,10 +450,10 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri return } - inactiveParam = param + inactiveParam = ¶m } else { var param bool = false - inactiveParam = param + inactiveParam = ¶m } result, err := c.service.GetPetsUsingBooleanQueryParameters(r.Context(), exprParam, groupingParam, inactiveParam) // If an error occurred, encode the error with the status code diff --git a/samples/server/petstore/go-chi-server/go/api_pet_service.go b/samples/server/petstore/go-chi-server/go/api_pet_service.go index a1796417d619..f5d14b661946 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet_service.go +++ b/samples/server/petstore/go-chi-server/go/api_pet_service.go @@ -15,6 +15,7 @@ import ( "net/http" "errors" "time" + "os" ) // PetAPIService is a service that implements the logic for the PetAPIServicer @@ -153,7 +154,7 @@ func (s *PetAPIService) GetPetsUsingBooleanQueryParameters(ctx context.Context, } // SearchPet - Search Pets by filters -func (s *PetAPIService) SearchPet(ctx context.Context, age **int64, price **float32, bornAfter **time.Time, old **bool) (ImplResponse, error) { +func (s *PetAPIService) SearchPet(ctx context.Context, age *int64, price *float32, bornAfter *time.Time, old *bool) (ImplResponse, error) { // TODO - update SearchPet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-chi-server/go/api_user.go b/samples/server/petstore/go-chi-server/go/api_user.go index 9fd0c1c5fc75..9f7fb1b9ab41 100644 --- a/samples/server/petstore/go-chi-server/go/api_user.go +++ b/samples/server/petstore/go-chi-server/go/api_user.go @@ -183,7 +183,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{"username"}, nil) return } - var confirmationParam bool + var confirmationParam *bool if query.Has("confirmation") { param, err := parseBoolParameter( query.Get("confirmation"), @@ -194,7 +194,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { return } - confirmationParam = param + confirmationParam = ¶m } else { } result, err := c.service.DeleteUser(r.Context(), usernameParam, confirmationParam) @@ -249,7 +249,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{Field: "password"}, nil) return } - var rememberMeParam bool + var rememberMeParam *bool if query.Has("remember_me") { param, err := parseBoolParameter( query.Get("remember_me"), @@ -260,7 +260,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } - rememberMeParam = param + rememberMeParam = ¶m } else { } result, err := c.service.LoginUser(r.Context(), usernameParam, passwordParam, rememberMeParam) From 7f837a876da5ae08e117131e63076f03a1e898d2 Mon Sep 17 00:00:00 2001 From: Phil Bugdahn Date: Mon, 15 Jul 2024 11:54:53 -0400 Subject: [PATCH 5/5] Generate non-required primitive query parameters as pointers (nil-able) --- .../codegen/languages/GoServerCodegen.java | 2 +- .../server/petstore/go/go-petstore/go/api.go | 6 +++--- .../petstore/go/go-petstore/go/api_pet_service.go | 6 +++--- samples/server/petstore/go-api-server/go/api.go | 14 +++++++------- .../server/petstore/go-api-server/go/api_pet.go | 4 ++-- .../petstore/go-api-server/go/api_pet_service.go | 14 +++++++------- samples/server/petstore/go-chi-server/go/api.go | 14 +++++++------- .../server/petstore/go-chi-server/go/api_pet.go | 4 ++-- .../petstore/go-chi-server/go/api_pet_service.go | 14 +++++++------- 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java index ad8ce829bee7..af4e2427abb7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java @@ -186,7 +186,7 @@ public GoServerCodegen() { public void postProcessParameter(CodegenParameter parameter) { super.postProcessParameter(parameter); - parameter.isNullable = parameter.notRequiredOrIsNullable(); + parameter.isNullable = parameter.isQueryParam && parameter.isPrimitiveType && parameter.notRequiredOrIsNullable(); } @Override diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api.go b/samples/openapi3/server/petstore/go/go-petstore/go/api.go index bca741e85cb6..0c7d4545afba 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api.go @@ -62,14 +62,14 @@ type UserAPIRouter interface { // and updated with the logic required for the API. type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) - DeletePet(context.Context, int64, *string) (ImplResponse, error) + DeletePet(context.Context, int64, string) (ImplResponse, error) FindPetsByStatus(context.Context, []string) (ImplResponse, error) // Deprecated FindPetsByTags(context.Context, []string) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) - UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) - UploadFile(context.Context, int64, *string, **os.File) (ImplResponse, error) + UpdatePetWithForm(context.Context, int64, string, string) (ImplResponse, error) + UploadFile(context.Context, int64, string, *os.File) (ImplResponse, error) } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go index 8cc2b381e6d6..cea78ae519a5 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go @@ -43,7 +43,7 @@ func (s *PetAPIService) AddPet(ctx context.Context, pet Pet) (ImplResponse, erro } // DeletePet - Deletes a pet -func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *string) (ImplResponse, error) { +func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey string) (ImplResponse, error) { // TODO - update DeletePet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -120,7 +120,7 @@ func (s *PetAPIService) UpdatePet(ctx context.Context, pet Pet) (ImplResponse, e } // UpdatePetWithForm - Updates a pet in the store with form data -func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name *string, status *string) (ImplResponse, error) { +func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name string, status string) (ImplResponse, error) { // TODO - update UpdatePetWithForm with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -131,7 +131,7 @@ func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name } // UploadFile - uploads an image -func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata *string, file **os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata string, file *os.File) (ImplResponse, error) { // TODO - update UploadFile with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-api-server/go/api.go b/samples/server/petstore/go-api-server/go/api.go index 1bfbf14f645f..3b6a0f4ea5f3 100644 --- a/samples/server/petstore/go-api-server/go/api.go +++ b/samples/server/petstore/go-api-server/go/api.go @@ -69,20 +69,20 @@ type UserAPIRouter interface { // and updated with the logic required for the API. type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) - DeletePet(context.Context, int64, *string) (ImplResponse, error) - FilterPetsByCategory(context.Context, Gender, Species, *[]Species) (ImplResponse, error) - FindPetsByStatus(context.Context, []string, *string, *string, *int32, *float32, *string) (ImplResponse, error) + DeletePet(context.Context, int64, string) (ImplResponse, error) + FilterPetsByCategory(context.Context, Gender, Species, []Species) (ImplResponse, error) + FindPetsByStatus(context.Context, []string, string, *string, *int32, *float32, *string) (ImplResponse, error) // Deprecated - FindPetsByTags(context.Context, []string, time.Time, *time.Time, *Colour) (ImplResponse, error) + FindPetsByTags(context.Context, []string, time.Time, *time.Time, Colour) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) GetPetImageById(context.Context, int64) (ImplResponse, error) GetPetsByTime(context.Context, time.Time) (ImplResponse, error) GetPetsUsingBooleanQueryParameters(context.Context, bool, *bool, *bool) (ImplResponse, error) SearchPet(context.Context, *int64, *float32, *time.Time, *bool) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) - UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) - UploadFile(context.Context, int64, *string, *[]string, **os.File) (ImplResponse, error) - UploadFileArrayOfFiles(context.Context, int64, *string, *[]*os.File) (ImplResponse, error) + UpdatePetWithForm(context.Context, int64, string, string) (ImplResponse, error) + UploadFile(context.Context, int64, string, []string, *os.File) (ImplResponse, error) + UploadFileArrayOfFiles(context.Context, int64, string, []*os.File) (ImplResponse, error) } diff --git a/samples/server/petstore/go-api-server/go/api_pet.go b/samples/server/petstore/go-api-server/go/api_pet.go index 89e666ce6ca5..bb064765fa7f 100644 --- a/samples/server/petstore/go-api-server/go/api_pet.go +++ b/samples/server/petstore/go-api-server/go/api_pet.go @@ -331,11 +331,11 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request bornBeforeParam = ¶m } else { } - var colourParam *Colour + var colourParam Colour if query.Has("colour") { param := Colour(query.Get("colour")) - colourParam = ¶m + colourParam = param } else { } result, err := c.service.FindPetsByTags(r.Context(), tagsParam, bornAfterParam, bornBeforeParam, colourParam) diff --git a/samples/server/petstore/go-api-server/go/api_pet_service.go b/samples/server/petstore/go-api-server/go/api_pet_service.go index f5d14b661946..8d801fed7863 100644 --- a/samples/server/petstore/go-api-server/go/api_pet_service.go +++ b/samples/server/petstore/go-api-server/go/api_pet_service.go @@ -44,7 +44,7 @@ func (s *PetAPIService) AddPet(ctx context.Context, pet Pet) (ImplResponse, erro } // DeletePet - Deletes a pet -func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *string) (ImplResponse, error) { +func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey string) (ImplResponse, error) { // TODO - update DeletePet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -55,7 +55,7 @@ func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *stri } // FilterPetsByCategory - Finds Pets -func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies *[]Species) (ImplResponse, error) { +func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies []Species) (ImplResponse, error) { // TODO - update FilterPetsByCategory with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -69,7 +69,7 @@ func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, } // FindPetsByStatus - Finds Pets by status -func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath *string, inlineEnum *string, defaultInt *int32, defaultNum *float32, defaultStr *string) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum *string, defaultInt *int32, defaultNum *float32, defaultStr *string) (ImplResponse, error) { // TODO - update FindPetsByStatus with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -84,7 +84,7 @@ func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, i // FindPetsByTags - Finds Pets by tags // Deprecated -func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore *time.Time, colour *Colour) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore *time.Time, colour Colour) (ImplResponse, error) { // TODO - update FindPetsByTags with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -185,7 +185,7 @@ func (s *PetAPIService) UpdatePet(ctx context.Context, pet Pet) (ImplResponse, e } // UpdatePetWithForm - Updates a pet in the store with form data -func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name *string, status *string) (ImplResponse, error) { +func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name string, status string) (ImplResponse, error) { // TODO - update UpdatePetWithForm with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -196,7 +196,7 @@ func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name } // UploadFile - uploads an image -func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata *string, extraOptionalMetadata *[]string, file **os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata string, extraOptionalMetadata []string, file *os.File) (ImplResponse, error) { // TODO - update UploadFile with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -207,7 +207,7 @@ func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalM } // UploadFileArrayOfFiles - uploads images (array of files) -func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata *string, files *[]*os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata string, files []*os.File) (ImplResponse, error) { // TODO - update UploadFileArrayOfFiles with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-chi-server/go/api.go b/samples/server/petstore/go-chi-server/go/api.go index 1bfbf14f645f..3b6a0f4ea5f3 100644 --- a/samples/server/petstore/go-chi-server/go/api.go +++ b/samples/server/petstore/go-chi-server/go/api.go @@ -69,20 +69,20 @@ type UserAPIRouter interface { // and updated with the logic required for the API. type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) - DeletePet(context.Context, int64, *string) (ImplResponse, error) - FilterPetsByCategory(context.Context, Gender, Species, *[]Species) (ImplResponse, error) - FindPetsByStatus(context.Context, []string, *string, *string, *int32, *float32, *string) (ImplResponse, error) + DeletePet(context.Context, int64, string) (ImplResponse, error) + FilterPetsByCategory(context.Context, Gender, Species, []Species) (ImplResponse, error) + FindPetsByStatus(context.Context, []string, string, *string, *int32, *float32, *string) (ImplResponse, error) // Deprecated - FindPetsByTags(context.Context, []string, time.Time, *time.Time, *Colour) (ImplResponse, error) + FindPetsByTags(context.Context, []string, time.Time, *time.Time, Colour) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) GetPetImageById(context.Context, int64) (ImplResponse, error) GetPetsByTime(context.Context, time.Time) (ImplResponse, error) GetPetsUsingBooleanQueryParameters(context.Context, bool, *bool, *bool) (ImplResponse, error) SearchPet(context.Context, *int64, *float32, *time.Time, *bool) (ImplResponse, error) UpdatePet(context.Context, Pet) (ImplResponse, error) - UpdatePetWithForm(context.Context, int64, *string, *string) (ImplResponse, error) - UploadFile(context.Context, int64, *string, *[]string, **os.File) (ImplResponse, error) - UploadFileArrayOfFiles(context.Context, int64, *string, *[]*os.File) (ImplResponse, error) + UpdatePetWithForm(context.Context, int64, string, string) (ImplResponse, error) + UploadFile(context.Context, int64, string, []string, *os.File) (ImplResponse, error) + UploadFileArrayOfFiles(context.Context, int64, string, []*os.File) (ImplResponse, error) } diff --git a/samples/server/petstore/go-chi-server/go/api_pet.go b/samples/server/petstore/go-chi-server/go/api_pet.go index 75214333e503..52cfac334c2e 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet.go +++ b/samples/server/petstore/go-chi-server/go/api_pet.go @@ -328,11 +328,11 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request bornBeforeParam = ¶m } else { } - var colourParam *Colour + var colourParam Colour if query.Has("colour") { param := Colour(query.Get("colour")) - colourParam = ¶m + colourParam = param } else { } result, err := c.service.FindPetsByTags(r.Context(), tagsParam, bornAfterParam, bornBeforeParam, colourParam) diff --git a/samples/server/petstore/go-chi-server/go/api_pet_service.go b/samples/server/petstore/go-chi-server/go/api_pet_service.go index f5d14b661946..8d801fed7863 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet_service.go +++ b/samples/server/petstore/go-chi-server/go/api_pet_service.go @@ -44,7 +44,7 @@ func (s *PetAPIService) AddPet(ctx context.Context, pet Pet) (ImplResponse, erro } // DeletePet - Deletes a pet -func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *string) (ImplResponse, error) { +func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey string) (ImplResponse, error) { // TODO - update DeletePet with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -55,7 +55,7 @@ func (s *PetAPIService) DeletePet(ctx context.Context, petId int64, apiKey *stri } // FilterPetsByCategory - Finds Pets -func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies *[]Species) (ImplResponse, error) { +func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, species Species, notSpecies []Species) (ImplResponse, error) { // TODO - update FilterPetsByCategory with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -69,7 +69,7 @@ func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, } // FindPetsByStatus - Finds Pets by status -func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath *string, inlineEnum *string, defaultInt *int32, defaultNum *float32, defaultStr *string) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum *string, defaultInt *int32, defaultNum *float32, defaultStr *string) (ImplResponse, error) { // TODO - update FindPetsByStatus with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -84,7 +84,7 @@ func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, i // FindPetsByTags - Finds Pets by tags // Deprecated -func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore *time.Time, colour *Colour) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByTags(ctx context.Context, tags []string, bornAfter time.Time, bornBefore *time.Time, colour Colour) (ImplResponse, error) { // TODO - update FindPetsByTags with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -185,7 +185,7 @@ func (s *PetAPIService) UpdatePet(ctx context.Context, pet Pet) (ImplResponse, e } // UpdatePetWithForm - Updates a pet in the store with form data -func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name *string, status *string) (ImplResponse, error) { +func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name string, status string) (ImplResponse, error) { // TODO - update UpdatePetWithForm with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -196,7 +196,7 @@ func (s *PetAPIService) UpdatePetWithForm(ctx context.Context, petId int64, name } // UploadFile - uploads an image -func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata *string, extraOptionalMetadata *[]string, file **os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalMetadata string, extraOptionalMetadata []string, file *os.File) (ImplResponse, error) { // TODO - update UploadFile with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -207,7 +207,7 @@ func (s *PetAPIService) UploadFile(ctx context.Context, petId int64, additionalM } // UploadFileArrayOfFiles - uploads images (array of files) -func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata *string, files *[]*os.File) (ImplResponse, error) { +func (s *PetAPIService) UploadFileArrayOfFiles(ctx context.Context, petId int64, additionalMetadata string, files []*os.File) (ImplResponse, error) { // TODO - update UploadFileArrayOfFiles with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation.