models

package
Version: v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

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 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 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"`
}

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 Interfaced

type Interfaced struct {
	CustomData interface{} `json:"custom_data"`
}

An Interfaced struct contains objects with interface definitions

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 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
	ID int64 `json:"id"`

	Ignored      string `json:"-"`
	IgnoredOther string `json:"-,omitempty"`

	// The Score of this model
	//
	// required: true
	// minimum: 3
	// maximum: 45
	// multiple of: 3
	Score int32 `json:"score"`

	// Name of this no model instance
	//
	// min length: 4
	// max length: 50
	// pattern: [A-Za-z0-9-.]*
	// required: true
	Name string `json:"name"`

	// Created holds the time when this entry was created
	//
	// required: false
	// read only: true
	Created strfmt.DateTime `json:"created"`

	// 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 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"`

	// 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
		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"`

		// 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"`

	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"`
}

A OtherTypes struct contains type aliases

type OverridingOne

type OverridingOne struct {
	SimpleOne
	Age int64
}

An OverridingOne is composed of a SimpleOne and overrides a field

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"`
}

A PrimateModel is a struct with nothing but primitives.

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 SimpleOne

type SimpleOne struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Age  int32  `json:"age"`
}

A SimpleOne is a model with a few simple fields

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 SomeIntType

type SomeIntType int64

SomeIntType is a type that refines int64

type SomeIntsType

type SomeIntsType []int64

SomeIntsType is a type that refines []int64

type SomePettedType

type SomePettedType mods.Pet

SomePettedType is a type that refines mods.Pet

type SomePettedsType

type SomePettedsType []mods.Pet

SomePettedsType is a type that refines mods.Pet

type SomeStringType

type SomeStringType string

SomeStringType is a type that refines string

type SomeStringsType

type SomeStringsType []string

SomeStringsType is a type that refines []string

type SomeTimeType

type SomeTimeType time.Time

SomeTimeType is a type that refines time.Time swagger:strfmt date-time

type SomeTimedType

type SomeTimedType strfmt.DateTime

SomeTimedType is a type that refines strfmt.DateTime

type SomeTimedsType

type SomeTimedsType []strfmt.DateTime

SomeTimedsType is a type that refines strfmt.DateTime

type SomeTimesType

type SomeTimesType []time.Time

SomeTimesType is a type that refines time.Time swagger:strfmt date-time

type Something

type Something struct {
	DID int64  `json:"did"`
	Cat string `json:"cat"`
}

A Something struct is used by other structs

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 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 aplication. 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

type WaterType

type WaterType interface {
	// swagger:name sweetWater
	SweetWater() bool
	// swagger:name saltWater
	SaltWater() bool
}

WaterType is an interface describing a water type

swagger:model water

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL