Documentation ¶
Index ¶
- type AllOfModel
- type BaseStruct
- type Cars
- type ComplexerOne
- type Embedded
- type EmbeddedStarExpr
- type Fish
- type FormattedModel
- type Gazelle
- type Giraffe
- type Identifiable
- type IgnoredFields
- type Interfaced
- type JSONPtrString
- type JSONString
- type MapTastic
- type MarshalTextMap
- type MarshalTextStruct
- type MarshalTextStructStrfmt
- type MarshalTextStructStrfmtPtr
- type ModelA
- type ModelS
- type ModelX
- type NamedWithType
- type NoModel
- type NullString
- type OtherTypes
- type OverridingOne
- type OverridingOneIgnore
- type Pointdexter
- type PrimateModel
- type SimpleComplexModel
- type SimpleOne
- type SliceAndDice
- type SomeArrayStringMap
- type SomeIntMap
- type SomeIntType
- type SomeIntTypeAlias
- type SomeIntsType
- type SomeObject
- type SomeObjectMap
- type SomePettedMap
- type SomePettedType
- type SomePettedsType
- type SomeSomethingMap
- type SomeStringMap
- type SomeStringType
- type SomeStringTypeAlias
- type SomeStringsType
- type SomeTimeMap
- type SomeTimeType
- type SomeTimedMap
- type SomeTimedType
- type SomeTimedsType
- type SomeTimesType
- type Something
- type SomethingType
- type SomethingsType
- type StoreOrder
- type TeslaCar
- type TextMarshalModel
- type URL
- type UUID
- type User
- type WaterType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllOfModel ¶
type AllOfModel struct { // swagger:allOf SimpleOne // swagger:allOf mods.Notable Something // not annotated with anything, so should be included CreatedAt strfmt.DateTime `json:"createdAt"` }
An AllOfModel is composed out of embedded structs but it should build an allOf property
type BaseStruct ¶
type BaseStruct struct { // ID of this no model instance. // ids in this application start at 11 and are smaller than 1000 // // required: true // minimum: > 10 // maximum: < 1000 ID int64 `json:"id"` // Name of this no model instance // // min length: 4 // max length: 50 // pattern: [A-Za-z0-9-.]* // required: true Name string `json:"name"` // StructType the type of this polymorphic model // // discriminator: true StructType string `json:"jsonClass"` }
A BaseStruct is a struct that has subtypes.
it should deserialize into one of the struct types that enlist for being implementations of this struct
swagger:model animal
type Cars ¶
type Cars struct {
Cars []*TeslaCar `json:"cars"`
}
Cars is a collection of cars
swagger:model cars
type ComplexerOne ¶
type ComplexerOne struct { SimpleOne mods.NotSelected mods.Notable CreatedAt strfmt.DateTime `json:"createdAt"` }
A ComplexerOne is composed of a SimpleOne and some extra fields
type Embedded ¶
type Embedded struct {
EmbeddedMember int64 `json:"embeddedMember"`
}
An Embedded is to be embedded in EmbeddedStarExpr
type EmbeddedStarExpr ¶
An EmbeddedStarExpr for testing the embedded StarExpr
type Fish ¶
type Fish interface { Identifiable // interfaces like this are included as if they were defined directly on this type // swagger:allOf WaterType // swagger:allOf mods.ExtraInfo mods.EmbeddedColor Items(id, size int64) []string // Name of this no model instance // // min length: 4 // max length: 50 // pattern: [A-Za-z0-9-.]* // required: true // swagger:name name Name() string // StructType the type of this polymorphic model // Discriminator: true // swagger:name jsonClass StructType() string }
Fish represents a base type implemented as interface the nullary methods of this interface will be included as
swagger:model fish
type FormattedModel ¶
type FormattedModel struct { A strfmt.Base64 `json:"a"` B strfmt.CreditCard `json:"b"` C strfmt.Date `json:"c"` D strfmt.DateTime `json:"d"` E strfmt.Duration `json:"e"` F strfmt.Email `json:"f"` G strfmt.HexColor `json:"g"` H strfmt.Hostname `json:"h"` I strfmt.IPv4 `json:"i"` J strfmt.IPv6 `json:"j"` K strfmt.ISBN `json:"k"` L strfmt.ISBN10 `json:"l"` M strfmt.ISBN13 `json:"m"` N strfmt.RGBColor `json:"n"` O strfmt.SSN `json:"o"` P strfmt.URI `json:"p"` Q strfmt.UUID `json:"q"` R strfmt.UUID3 `json:"r"` S strfmt.UUID4 `json:"s"` T strfmt.UUID5 `json:"t"` U strfmt.MAC `json:"u"` }
A FormattedModel is a struct with only strfmt types
It only has values 1 level deep and is used for testing the conversion
type Gazelle ¶
type Gazelle struct { // swagger:allOf a.b.c.d.E BaseStruct // The size of the horns HornSize float32 `json:"hornSize"` }
A Gazelle is a struct is discriminated for BaseStruct.
The struct includes the BaseStruct and that embedded value is annotated with the discriminator value annotation so it where it only requires 1 argument because it knows which discriminator type this belongs to
swagger:model gazelle
type Giraffe ¶
type Giraffe struct { // swagger:allOf BaseStruct // NeckSize the size of the neck of this giraffe NeckSize int64 `json:"neckSize"` }
A Giraffe is a struct that embeds BaseStruct
the annotation is not necessary here because of inclusion of a discriminated type it infers the name of the x-class value from its context
swagger:model giraffe
type Identifiable ¶
type Identifiable interface { // ID of this no model instance. // ids in this application start at 11 and are smaller than 1000 // // required: true // minimum: > 10 // maximum: < 1000 // swagger:name id ID() int64 }
Identifiable is an interface for things that have an ID
type IgnoredFields ¶
type IgnoredFields struct { SomeIncludedField string `json:"someIncludedField"` // swagger:ignore SomeIgnoredField string `json:"someIgnoredField"` // This swagger:ignore tag won't work - it needs to be in the field's doc // block SomeErroneouslyIncludedField string `json:"someErroneouslyIncludedField"` // swagger:ignore }
IgnoredFields demostrates the use of swagger:ignore on struct fields.
swagger:model ignoredFields
type Interfaced ¶
type Interfaced struct {
CustomData interface{} `json:"custom_data"`
}
An Interfaced struct contains objects with interface definitions
type JSONPtrString ¶
type JSONPtrString struct { // Should be encoded as a string with string format "integer" SomeInt *int `json:"someInt,string"` SomeInt8 *int8 `json:"someInt8,string"` SomeInt16 *int16 `json:"someInt16,string"` SomeInt32 *int32 `json:"someInt32,string"` SomeInt64 *int64 `json:"someInt64,string"` SomeUint *uint `json:"someUint,string"` SomeUint8 *uint8 `json:"someUint8,string"` SomeUint16 *uint16 `json:"someUint16,string"` SomeUint32 *uint32 `json:"someUint32,string"` SomeUint64 *uint64 `json:"someUint64,string"` // Should be encoded as a string with string format "double" SomeFloat64 *float64 `json:"someFloat64,string"` // Should be encoded as a string with no format SomeString *string `json:"someString,string"` // Should be encoded as a string with no format SomeBool *bool `json:"someBool,string"` // The ",string" directive should be ignore before the type isn't scalar SomethingElse *Cars `json:"somethingElse,string"` }
JSONPtrString has fields with ",string" JSON directives.
swagger:model jsonPtrString
type JSONString ¶
type JSONString struct { // Should be encoded as a string with string format "integer" SomeInt int `json:"someInt,string"` SomeInt8 int8 `json:"someInt8,string"` SomeInt16 int16 `json:"someInt16,string"` SomeInt32 int32 `json:"someInt32,string"` SomeInt64 int64 `json:"someInt64,string"` SomeUint uint `json:"someUint,string"` SomeUint8 uint8 `json:"someUint8,string"` SomeUint16 uint16 `json:"someUint16,string"` SomeUint32 uint32 `json:"someUint32,string"` SomeUint64 uint64 `json:"someUint64,string"` // Should be encoded as a string with string format "double" SomeFloat64 float64 `json:"someFloat64,string"` // Should be encoded as a string with no format SomeString string `json:"someString,string"` // Should be encoded as a string with no format SomeBool bool `json:"someBool,string"` // The ",string" directive should be ignore before the type isn't scalar SomethingElse Cars `json:"somethingElse,string"` // The ",omitempty,string" directive should be valid SomeDefaultInt int `json:",omitempty,string"` }
JSONString has fields with ",string" JSON directives.
swagger:model jsonString
type MapTastic ¶
type MapTastic struct { IDs map[string]int64 `json:"ids"` Names map[string]string `json:"names"` UUIDs map[string]strfmt.UUID `json:"uuids"` Tops map[string]Something `json:"tops"` NotSels map[string]mods.NotSelected `json:"notSels"` Embs map[string]struct { CID map[string]int64 `json:"cid"` Baz map[string]string `json:"baz"` } `json:"embs"` PtrIDs map[string]*int64 `json:"ptrIds"` PtrNames map[string]*string `json:"ptrNames"` PtrUUIDs map[string]*strfmt.UUID `json:"ptrUuids"` PtrTops map[string]*Something `json:"ptrTops"` PtrNotSels map[string]*mods.NotSelected `json:"ptrNotSels"` PtrEmbs map[string]*struct { PtrCID map[string]*int64 `json:"ptrCid"` PtrBaz map[string]*string `json:"ptrBaz"` } `json:"ptrEmbs"` }
A MapTastic struct contains only maps
the values of the maps are structs, primitives or string formats there is also a pointer version of each property
type MarshalTextMap ¶
type MarshalTextMap map[string]interface{}
func (MarshalTextMap) MarshalText ¶
func (cm MarshalTextMap) MarshalText() ([]byte, error)
type MarshalTextStruct ¶
type MarshalTextStruct struct {
Hola string
}
func (MarshalTextStruct) MarshalText ¶
func (cm MarshalTextStruct) MarshalText() ([]byte, error)
type MarshalTextStructStrfmt ¶
type MarshalTextStructStrfmt struct {
Foo string `json:"foo"`
}
swagger:strfmt date-time
func (MarshalTextStructStrfmt) MarshalText ¶
func (cm MarshalTextStructStrfmt) MarshalText() ([]byte, error)
type MarshalTextStructStrfmtPtr ¶
type MarshalTextStructStrfmtPtr struct {
Foo string `json:"foo"`
}
swagger:strfmt date-time
func (MarshalTextStructStrfmtPtr) MarshalText ¶
func (cm MarshalTextStructStrfmtPtr) MarshalText() ([]byte, error)
type ModelA ¶
type ModelA struct { Tesla TeslaCar // The number of doors on this Model A Doors int `json:"doors"` }
The ModelA version of the tesla car
swagger:model modelA
type ModelS ¶
type ModelS struct { // swagger:allOf com.tesla.models.ModelS TeslaCar // The edition of this Model S Edition string `json:"edition"` }
The ModelS version of the tesla car
swagger:model modelS
type ModelX ¶
type ModelX struct { // swagger:allOf com.tesla.models.ModelX TeslaCar // The number of doors on this Model X Doors int `json:"doors"` }
The ModelX version of the tesla car
swagger:model modelX
type NamedWithType ¶
type NamedWithType struct {
SomeMap SomeObjectMap `json:"some_map"`
}
swagger:model namedWithType
type NoModel ¶
type NoModel struct { // ID of this no model instance. // ids in this application start at 11 and are smaller than 1000 // // required: true // minimum: > 10 // maximum: < 1000 // default: 11 ID int64 `json:"id"` Ignored string `json:"-"` IgnoredOther string `json:"-,omitempty"` // A field which has omitempty set but no name NoNameOmitEmpty string `json:",omitempty"` // Note is a free form data in base64 // // swagger:strfmt byte Note []byte `json:"noteb64,omitempty"` // The Score of this model // // required: true // minimum: 3 // maximum: 45 // multiple of: 3 // example: 27 Score int32 `json:"score"` // Name of this no model instance // // min length: 4 // max length: 50 // pattern: [A-Za-z0-9-.]* // required: true // // Extensions: // --- // x-property-value: value // x-property-array: // - value1 // - value2 // x-property-array-obj: // - name: obj // value: field // --- // Name string `json:"name"` // Created holds the time when this entry was created // // required: false // read only: true Created strfmt.DateTime `json:"created"` // GoTimeCreated holds the time when this entry was created in go time.Time // // required: false GoTimeCreated time.Time `json:"gocreated"` // a FooSlice has foos which are strings // // min items: 3 // max items: 10 // unique: true // items.minLength: 3 // items.maxLength: 10 // items.pattern: \w+ FooSlice []string `json:"foo_slice"` // a TimeSlice is a slice of times // // min items: 3 // max items: 10 // unique: true TimeSlice []time.Time `json:"time_slice"` // a BarSlice has bars which are strings // // min items: 3 // max items: 10 // unique: true // items.minItems: 4 // items.maxItems: 9 // items.items.minItems: 5 // items.items.maxItems: 8 // items.items.items.minLength: 3 // items.items.items.maxLength: 10 // items.items.items.pattern: \w+ BarSlice [][][]string `json:"bar_slice"` // a DeepSlice has bars which are time // // min items: 3 // max items: 10 // unique: true // items.minItems: 4 // items.maxItems: 9 // items.items.minItems: 5 // items.items.maxItems: 8 DeepTimeSlice [][][]time.Time `json:"deep_time_slice"` // the items for this order Items []struct { // ID of this no model instance. // ids in this application start at 11 and are smaller than 1000 // // required: true // minimum: > 10 // maximum: < 1000 // default: 11 ID int32 `json:"id"` // The Pet to add to this NoModel items bucket. // Pets can appear more than once in the bucket // // required: true Pet *mods.Pet `json:"pet"` // The amount of pets to add to this bucket. // // required: true // minimum: 1 // maximum: 10 Quantity int16 `json:"quantity"` // A dummy expiration date. // // required: true Expiration time.Time `json:"expiration"` // Notes to add to this item. // This can be used to add special instructions. // // required: false Notes string `json:"notes"` AlsoIgnored string `json:"-"` } `json:"items"` }
NoModel is a struct without an annotation. NoModel exists in a package but is not annotated with the swagger model annotations so it should now show up in a test.
type OtherTypes ¶
type OtherTypes struct { Named SomeStringType `json:"named"` Numbered SomeIntType `json:"numbered"` Dated SomeTimeType `json:"dated"` Timed SomeTimedType `json:"timed"` Petted SomePettedType `json:"petted"` Somethinged SomethingType `json:"somethinged"` StrMap SomeStringMap `json:"strMap"` StrArrMap SomeArrayStringMap `json:"strArrMap"` ManyNamed SomeStringsType `json:"manyNamed"` ManyNumbered SomeIntsType `json:"manyNumbered"` ManyDated SomeTimesType `json:"manyDated"` ManyTimed SomeTimedsType `json:"manyTimed"` ManyPetted SomePettedsType `json:"manyPetted"` ManySomethinged SomethingsType `json:"manySomethinged"` Nameds []SomeStringType `json:"nameds"` Numbereds []SomeIntType `json:"numbereds"` Dateds []SomeTimeType `json:"dateds"` Timeds []SomeTimedType `json:"timeds"` Petteds []SomePettedType `json:"petteds"` Somethingeds []SomethingType `json:"somethingeds"` ModsNamed mods.SomeStringType `json:"modsNamed"` ModsNumbered mods.SomeIntType `json:"modsNumbered"` ModsDated mods.SomeTimeType `json:"modsDated"` ModsTimed mods.SomeTimedType `json:"modsTimed"` ModsPetted mods.SomePettedType `json:"modsPetted"` ModsNameds []mods.SomeStringType `json:"modsNameds"` ModsNumbereds []mods.SomeIntType `json:"modsNumbereds"` ModsDateds []mods.SomeTimeType `json:"modsDateds"` ModsTimeds []mods.SomeTimedType `json:"modsTimeds"` ModsPetteds []mods.SomePettedType `json:"modsPetteds"` ManyModsNamed mods.SomeStringsType `json:"manyModsNamed"` ManyModsNumbered mods.SomeIntsType `json:"manyModsNumbered"` ManyModsDated mods.SomeTimesType `json:"manyModsDated"` ManyModsTimed mods.SomeTimedsType `json:"manyModsTimed"` ManyModsPetted mods.SomePettedsType `json:"manyModsPetted"` ManyModsPettedPtr mods.SomePettedsPtrType `json:"manyModsPettedPtr"` NamedAlias SomeStringTypeAlias `json:"namedAlias"` NumberedAlias SomeIntTypeAlias `json:"numberedAlias"` NamedsAlias []SomeStringTypeAlias `json:"namedsAlias"` NumberedsAlias []SomeIntTypeAlias `json:"numberedsAlias"` }
A OtherTypes struct contains type aliases
type OverridingOne ¶
An OverridingOne is composed of a SimpleOne and overrides a field
type OverridingOneIgnore ¶
An OverridingOneIgnore is composed of a SimpleOne and overrides a field to ignore it
type Pointdexter ¶
type Pointdexter struct { ID *int64 `json:"id"` Name *string `json:"name"` T *strfmt.UUID5 `json:"t"` Top *Something `json:"top"` NotSel *mods.NotSelected `json:"notSel"` Emb *struct { CID *int64 `json:"cid"` Baz *string `json:"baz"` } `json:"emb"` }
Pointdexter is a struct with only pointers
type PrimateModel ¶
type PrimateModel struct { A bool `json:"a"` B rune `json:"b"` C string `json:"c"` D int `json:"d"` E int8 `json:"e"` F int16 `json:"f"` G int32 `json:"g"` H int64 `json:"h"` I uint `json:"i"` J uint8 `json:"j"` K uint16 `json:"k"` L uint32 `json:"l"` M uint64 `json:"m"` N float32 `json:"n"` O float64 `json:"o"` P byte `json:"p"` Q uintptr `json:"q"` }
A PrimateModel is a struct with nothing but builtins.
It only has values 1 level deep and each of those is of a very simple builtin type.
type SimpleComplexModel ¶
type SimpleComplexModel struct { Top Something `json:"top"` NotSel mods.NotSelected `json:"notSel"` Emb struct { CID int64 `json:"cid"` Baz string `json:"baz"` } `json:"emb"` }
A SimpleComplexModel is a struct with only other struct types
It doesn't have slices or arrays etc but only complex types so also no primitives or string formatters
type SliceAndDice ¶
type SliceAndDice struct { IDs []int64 `json:"ids"` Names []string `json:"names"` UUIDs []strfmt.UUID `json:"uuids"` Tops []Something `json:"tops"` NotSels []mods.NotSelected `json:"notSels"` Embs []struct { CID []int64 `json:"cid"` Baz []string `json:"baz"` } `json:"embs"` PtrIDs []*int64 `json:"ptrIds"` PtrNames []*string `json:"ptrNames"` PtrUUIDs []*strfmt.UUID `json:"ptrUuids"` PtrTops []*Something `json:"ptrTops"` PtrNotSels []*mods.NotSelected `json:"ptrNotSels"` PtrEmbs []*struct { PtrCID []*int64 `json:"ptrCid"` PtrBaz []*string `json:"ptrBaz"` } `json:"ptrEmbs"` }
A SliceAndDice struct contains only slices
the elements of the slices are structs, primitives or string formats there is also a pointer version of each property
type SomeArrayStringMap ¶
SomeArrayStringMap is a type that refines a array of strings value map
type SomeIntMap ¶
SomeIntMap is a type that refines an int value map
type SomeIntTypeAlias ¶
type SomeIntTypeAlias int64
SomeIntTypeAlias is a type that refines int64 swagger:alias
type SomeObject ¶
type SomeObject map[string]interface{}
SomeObject is a type that refines an untyped map
type SomePettedMap ¶
SomePettedMap is a type that refines a pet value map
type SomePettedsType ¶
SomePettedsType is a type that refines mods.Pet
type SomeSomethingMap ¶
SomeSomethingMap is a type that refines a Something value map
type SomeStringMap ¶
SomeStringMap is a type that refines a string value map
type SomeStringTypeAlias ¶
type SomeStringTypeAlias string
SomeStringTypeAlias is a type that refines string swagger:alias
type SomeStringsType ¶
type SomeStringsType []string
SomeStringsType is a type that refines []string
type SomeTimeMap ¶
SomeTimeMap is a type that refines a time.Time value map swagger:strfmt date-time
type SomeTimeType ¶
SomeTimeType is a type that refines time.Time swagger:strfmt date-time
type SomeTimedMap ¶
SomeTimedMap is a type that refines an strfmt.DateTime value map
type SomeTimedType ¶
SomeTimedType is a type that refines strfmt.DateTime
type SomeTimedsType ¶
SomeTimedsType is a type that refines strfmt.DateTime
type SomeTimesType ¶
SomeTimesType is a type that refines time.Time swagger:strfmt date-time
type SomethingType ¶
type SomethingType Something
SomethingType is a type that refines a type contained in the same package
type SomethingsType ¶
type SomethingsType []Something
SomethingsType is a type that refines a type contained in the same package
type StoreOrder ¶
type StoreOrder struct { // the id for this order // // required: true // min: 1 ID int64 `json:"id"` // the name for this user // // required: true // min length: 3 UserID int64 `json:"userId"` // the category of this user // // required: true // default: bar // enum: foo,bar,none Category string `json:"category"` // the items for this order Items []struct { ID int32 `json:"id"` Pet mods.Pet `json:"pet"` Quantity int16 `json:"quantity"` } `json:"items"` }
StoreOrder represents an order in this application. ¶
An order can either be created, processed or completed.
swagger:model order
type TeslaCar ¶
type TeslaCar interface { // The model of tesla car // // discriminated: true // swagger:name model Model() string // AutoPilot returns true when it supports autopilot // swagger:name autoPilot AutoPilot() bool }
TeslaCar is a tesla car
swagger:model
type TextMarshalModel ¶
type TextMarshalModel struct { ID UUID `json:"id"` IDs []UUID `json:"ids"` Struct MarshalTextStruct `json:"struct"` Map MarshalTextMap `json:"map"` MapUUID map[string]UUID `json:"mapUUID"` URL url.URL `json:"url"` // url.URL not has TextMarshal! Time time.Time `json:"time"` StructStrfmt MarshalTextStructStrfmt `json:"structStrfmt"` StructStrfmtPtr *MarshalTextStructStrfmtPtr `json:"structStrfmtPtr"` CustomURL URL `json:"customUrl"` }
TextMarshalModel demostrates the use of MarshalText from different fields
swagger:model TextMarshalModel
type UUID ¶
type UUID [16]byte
UUID is a type that represents a UUID as a string
func (UUID) MarshalText ¶
type User ¶
type User struct { // the id for this user // // required: true // min: 1 ID int64 `json:"id"` // the name for this user // required: true // min length: 3 Name string `json:"name"` // the email address for this user // // required: true // unique: true Email strfmt.Email `json:"login"` // the friends for this user Friends []User `json:"friends"` }
User represents the user for this application
A user is the security principal for this application. It's also used as one of main axis for reporting.
A user can have friends with whom they can share what they like.
swagger:model