Skip to content

Commit

Permalink
Regenerate (OpenAPITools#17389)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwj5 authored Dec 13, 2023
1 parent 56e2c49 commit b7f31dd
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@ paths:
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- name: inlineEnumPath
in: path
description: Entity type
schema:
type: string
enum:
- "OPTION_1"
- "OPTION_2"
- "OPTION_3"
- name: inlineEnum
in: query
description: Entity type
schema:
type: string
enum:
- "OPTION_1"
- "OPTION_2"
- "OPTION_3"
- name: status
in: query
description: Status values that need to be considered for filter
Expand Down
24 changes: 24 additions & 0 deletions samples/server/petstore/go-api-server/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ paths:
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- description: Entity type
explode: false
in: path
name: inlineEnumPath
required: false
schema:
enum:
- OPTION_1
- OPTION_2
- OPTION_3
type: string
style: simple
- description: Entity type
explode: true
in: query
name: inlineEnum
required: false
schema:
enum:
- OPTION_1
- OPTION_2
- OPTION_3
type: string
style: form
- deprecated: true
description: Status values that need to be considered for filter
explode: false
Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/go-api-server/go/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ 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) (ImplResponse, error)
FindPetsByStatus(context.Context, []string, string, string) (ImplResponse, error)
// Deprecated
FindPetsByTags(context.Context, []string, time.Time, time.Time) (ImplResponse, error)
GetPetById(context.Context, int64) (ImplResponse, error)
Expand Down
12 changes: 11 additions & 1 deletion samples/server/petstore/go-api-server/go/api_pet.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,22 @@ func (c *PetAPIController) FilterPetsByCategory(w http.ResponseWriter, r *http.R

// FindPetsByStatus - Finds Pets by status
func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
query := r.URL.Query()
var statusParam []string
if query.Has("status") {
statusParam = strings.Split(query.Get("status"), ",")
}
result, err := c.service.FindPetsByStatus(r.Context(), statusParam)
inlineEnumPathParam := params["inlineEnumPath"]
if inlineEnumPathParam == "" {
c.errorHandler(w, r, &RequiredError{"inlineEnumPath"}, nil)
return
}
var inlineEnumParam string
if query.Has("inlineEnum") {
inlineEnumParam = query.Get("inlineEnum")
}
result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam)
// If an error occurred, encode the error with the status code
if err != nil {
c.errorHandler(w, r, err, &result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,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) (ImplResponse, error) {
func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum 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.

Expand Down
24 changes: 24 additions & 0 deletions samples/server/petstore/go-chi-server/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ paths:
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- description: Entity type
explode: false
in: path
name: inlineEnumPath
required: false
schema:
enum:
- OPTION_1
- OPTION_2
- OPTION_3
type: string
style: simple
- description: Entity type
explode: true
in: query
name: inlineEnum
required: false
schema:
enum:
- OPTION_1
- OPTION_2
- OPTION_3
type: string
style: form
- deprecated: true
description: Status values that need to be considered for filter
explode: false
Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/go-chi-server/go/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ 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) (ImplResponse, error)
FindPetsByStatus(context.Context, []string, string, string) (ImplResponse, error)
// Deprecated
FindPetsByTags(context.Context, []string, time.Time, time.Time) (ImplResponse, error)
GetPetById(context.Context, int64) (ImplResponse, error)
Expand Down
11 changes: 10 additions & 1 deletion samples/server/petstore/go-chi-server/go/api_pet.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,16 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque
if query.Has("status") {
statusParam = strings.Split(query.Get("status"), ",")
}
result, err := c.service.FindPetsByStatus(r.Context(), statusParam)
inlineEnumPathParam := chi.URLParam(r, "inlineEnumPath")
if inlineEnumPathParam == "" {
c.errorHandler(w, r, &RequiredError{"inlineEnumPath"}, nil)
return
}
var inlineEnumParam string
if query.Has("inlineEnum") {
inlineEnumParam = query.Get("inlineEnum")
}
result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam)
// If an error occurred, encode the error with the status code
if err != nil {
c.errorHandler(w, r, err, &result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,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) (ImplResponse, error) {
func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum 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.

Expand Down

0 comments on commit b7f31dd

Please sign in to comment.