forked from loafle/openapi-generator-original
* Update error.go and fix lint * Regen * Fix incorrect change * Fix handler issue * Regenerate
68 lines
1.5 KiB
Go
68 lines
1.5 KiB
Go
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
/*
|
|
* OpenAPI Petstore
|
|
*
|
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
*
|
|
* API version: 1.0.0
|
|
*/
|
|
|
|
package petstoreserver
|
|
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
|
|
|
|
type Colour string
|
|
|
|
// List of Colour
|
|
const (
|
|
BLUE Colour = "Blue"
|
|
WHITE Colour = "White"
|
|
)
|
|
|
|
// AllowedColourEnumValues is all the allowed values of Colour enum
|
|
var AllowedColourEnumValues = []Colour{
|
|
"Blue",
|
|
"White",
|
|
}
|
|
|
|
// validColourEnumValue provides a map of Colours for fast verification of use input
|
|
var validColourEnumValues = map[Colour]struct{}{
|
|
"Blue": {},
|
|
"White": {},
|
|
}
|
|
|
|
// IsValid return true if the value is valid for the enum, false otherwise
|
|
func (v Colour) IsValid() bool {
|
|
_, ok := validColourEnumValues[v]
|
|
return ok
|
|
}
|
|
|
|
// NewColourFromValue returns a pointer to a valid Colour
|
|
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
|
func NewColourFromValue(v string) (Colour, error) {
|
|
ev := Colour(v)
|
|
if ev.IsValid() {
|
|
return ev, nil
|
|
}
|
|
|
|
return "", fmt.Errorf("invalid value '%v' for Colour: valid values are %v", v, AllowedColourEnumValues)
|
|
}
|
|
|
|
|
|
|
|
// AssertColourRequired checks if the required fields are not zero-ed
|
|
func AssertColourRequired(obj Colour) error {
|
|
return nil
|
|
}
|
|
|
|
// AssertColourConstraints checks if the values respects the defined constraints
|
|
func AssertColourConstraints(obj Colour) error {
|
|
return nil
|
|
}
|