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 JSONString
- type MapTastic
- type ModelA
- type ModelS
- type ModelX
- type NoModel
- 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 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 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 ¶ added in v0.17.0
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 ¶ added in v0.17.0
type Embedded struct {
EmbeddedMember int64 `json:"embeddedMember"`
}
An Embedded is to be embedded in EmbeddedStarExpr
type EmbeddedStarExpr ¶ added in v0.17.0
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 ¶ added in v0.17.0
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 JSONString ¶ added in v0.17.0
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"` }
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 ModelA ¶ added in v0.17.0
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 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"` // 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 ¶ added in v0.17.0
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 ¶ added in v0.17.0
SomeArrayStringMap is a type that refines a array of strings value map
type SomeIntMap ¶ added in v0.17.0
SomeIntMap is a type that refines an int value map
type SomeIntTypeAlias ¶ added in v0.17.0
type SomeIntTypeAlias int64
SomeIntTypeAlias is a type that refines int64 swagger:alias
type SomeObject ¶ added in v0.17.0
type SomeObject map[string]interface{}
SomeObject is a type that refines an untyped map
type SomePettedMap ¶ added in v0.17.0
SomePettedMap is a type that refines a pet value map
type SomePettedsType ¶
SomePettedsType is a type that refines mods.Pet
type SomeSomethingMap ¶ added in v0.17.0
SomeSomethingMap is a type that refines a Something value map
type SomeStringMap ¶ added in v0.17.0
SomeStringMap is a type that refines a string value map
type SomeStringTypeAlias ¶ added in v0.17.0
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 ¶ added in v0.17.0
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 ¶ added in v0.17.0
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 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