forked from loafle/openapi-generator-original
Add sample spec to catch external file reference issues in swagger-parser (#17773)
* add a sample that catches swagger-parser issues with external refs * generate samples for new test spec
This commit is contained in:
163
samples/client/echo_api/go-external-refs/model_bird.go
Normal file
163
samples/client/echo_api/go-external-refs/model_bird.go
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Bird type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Bird{}
|
||||
|
||||
// Bird struct for Bird
|
||||
type Bird struct {
|
||||
Size *string `json:"size,omitempty"`
|
||||
Color *string `json:"color,omitempty"`
|
||||
}
|
||||
|
||||
// NewBird instantiates a new Bird object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewBird() *Bird {
|
||||
this := Bird{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewBirdWithDefaults instantiates a new Bird object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewBirdWithDefaults() *Bird {
|
||||
this := Bird{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetSize returns the Size field value if set, zero value otherwise.
|
||||
func (o *Bird) GetSize() string {
|
||||
if o == nil || IsNil(o.Size) {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.Size
|
||||
}
|
||||
|
||||
// GetSizeOk returns a tuple with the Size field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Bird) GetSizeOk() (*string, bool) {
|
||||
if o == nil || IsNil(o.Size) {
|
||||
return nil, false
|
||||
}
|
||||
return o.Size, true
|
||||
}
|
||||
|
||||
// HasSize returns a boolean if a field has been set.
|
||||
func (o *Bird) HasSize() bool {
|
||||
if o != nil && !IsNil(o.Size) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetSize gets a reference to the given string and assigns it to the Size field.
|
||||
func (o *Bird) SetSize(v string) {
|
||||
o.Size = &v
|
||||
}
|
||||
|
||||
// GetColor returns the Color field value if set, zero value otherwise.
|
||||
func (o *Bird) GetColor() string {
|
||||
if o == nil || IsNil(o.Color) {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.Color
|
||||
}
|
||||
|
||||
// GetColorOk returns a tuple with the Color field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Bird) GetColorOk() (*string, bool) {
|
||||
if o == nil || IsNil(o.Color) {
|
||||
return nil, false
|
||||
}
|
||||
return o.Color, true
|
||||
}
|
||||
|
||||
// HasColor returns a boolean if a field has been set.
|
||||
func (o *Bird) HasColor() bool {
|
||||
if o != nil && !IsNil(o.Color) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetColor gets a reference to the given string and assigns it to the Color field.
|
||||
func (o *Bird) SetColor(v string) {
|
||||
o.Color = &v
|
||||
}
|
||||
|
||||
func (o Bird) MarshalJSON() ([]byte, error) {
|
||||
toSerialize,err := o.ToMap()
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
func (o Bird) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if !IsNil(o.Size) {
|
||||
toSerialize["size"] = o.Size
|
||||
}
|
||||
if !IsNil(o.Color) {
|
||||
toSerialize["color"] = o.Color
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableBird struct {
|
||||
value *Bird
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableBird) Get() *Bird {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableBird) Set(val *Bird) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableBird) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableBird) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableBird(val *Bird) *NullableBird {
|
||||
return &NullableBird{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableBird) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableBird) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user