forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin' into 7.0.x
This commit is contained in:
@@ -47,6 +47,9 @@ paths:
|
||||
- pet
|
||||
put:
|
||||
description: ""
|
||||
externalDocs:
|
||||
description: API documentation for the updatePet operation
|
||||
url: http://petstore.swagger.io/v2/doc/updatePet
|
||||
operationId: updatePet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
@@ -348,7 +351,7 @@ paths:
|
||||
- store
|
||||
get:
|
||||
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||
values will generated exceptions
|
||||
values will generate exceptions
|
||||
operationId: getOrderById
|
||||
parameters:
|
||||
- description: ID of pet that needs to be fetched
|
||||
|
||||
@@ -76,7 +76,11 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string,
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
if i != nil {
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
|
||||
@@ -167,7 +171,15 @@ func parseInt32Parameter(param string, required bool) (int32, error) {
|
||||
}
|
||||
|
||||
// parseBoolParameter parses a string parameter to a bool
|
||||
func parseBoolParameter(param string) (bool, error) {
|
||||
func parseBoolParameter(param string, required bool) (bool, error) {
|
||||
if param == "" {
|
||||
if required {
|
||||
return false, errors.New(errMsgRequiredMissing)
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
val, err := strconv.ParseBool(param)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@@ -222,4 +234,4 @@ func parseInt32ArrayParameter(param, delim string, required bool) ([]int32, erro
|
||||
}
|
||||
|
||||
return ints, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user