github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/fixtures/goparsing/classification/models/nomodel.go (about)

     1  // Copyright 2015 go-swagger maintainers
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //    http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package models
    16  
    17  import (
    18  	"net/url"
    19  	"time"
    20  
    21  	"github.com/go-openapi/strfmt"
    22  	"github.com/go-swagger/go-swagger/fixtures/goparsing/classification/transitive/mods"
    23  )
    24  
    25  // NoModel is a struct without an annotation.
    26  // NoModel exists in a package
    27  // but is not annotated with the swagger model annotations
    28  // so it should now show up in a test.
    29  type NoModel struct {
    30  	// ID of this no model instance.
    31  	// ids in this application start at 11 and are smaller than 1000
    32  	//
    33  	// required: true
    34  	// minimum: > 10
    35  	// maximum: < 1000
    36  	// default: 11
    37  	ID int64 `json:"id"`
    38  
    39  	Ignored      string `json:"-"`
    40  	IgnoredOther string `json:"-,omitempty"`
    41  
    42  	// A field which has omitempty set but no name
    43  	NoNameOmitEmpty string `json:",omitempty"`
    44  
    45  	// Note is a free form data in base64
    46  	//
    47  	// swagger:strfmt byte
    48  	Note []byte `json:"noteb64,omitempty"`
    49  
    50  	// The Score of this model
    51  	//
    52  	// required: true
    53  	// minimum: 3
    54  	// maximum: 45
    55  	// multiple of: 3
    56  	// example: 27
    57  	Score int32 `json:"score"`
    58  
    59  	// Name of this no model instance
    60  	//
    61  	// min length: 4
    62  	// max length: 50
    63  	// pattern: [A-Za-z0-9-.]*
    64  	// required: true
    65  	//
    66  	// Extensions:
    67  	// ---
    68  	// x-property-value: value
    69  	// x-property-array:
    70  	//   - value1
    71  	//   - value2
    72  	// x-property-array-obj:
    73  	//   - name: obj
    74  	//     value: field
    75  	// ---
    76  	//
    77  	Name string `json:"name"`
    78  
    79  	// Created holds the time when this entry was created
    80  	//
    81  	// required: false
    82  	// read only: true
    83  	Created strfmt.DateTime `json:"created"`
    84  
    85  	// GoTimeCreated holds the time when this entry was created in go time.Time
    86  	//
    87  	// required: false
    88  	GoTimeCreated time.Time `json:"gocreated"`
    89  
    90  	// a FooSlice has foos which are strings
    91  	//
    92  	// min items: 3
    93  	// max items: 10
    94  	// unique: true
    95  	// items.minLength: 3
    96  	// items.maxLength: 10
    97  	// items.pattern: \w+
    98  	FooSlice []string `json:"foo_slice"`
    99  
   100  	// a TimeSlice is a slice of times
   101  	//
   102  	// min items: 3
   103  	// max items: 10
   104  	// unique: true
   105  	TimeSlice []time.Time `json:"time_slice"`
   106  
   107  	// a BarSlice has bars which are strings
   108  	//
   109  	// min items: 3
   110  	// max items: 10
   111  	// unique: true
   112  	// items.minItems: 4
   113  	// items.maxItems: 9
   114  	// items.items.minItems: 5
   115  	// items.items.maxItems: 8
   116  	// items.items.items.minLength: 3
   117  	// items.items.items.maxLength: 10
   118  	// items.items.items.pattern: \w+
   119  	BarSlice [][][]string `json:"bar_slice"`
   120  
   121  	// a DeepSlice has bars which are time
   122  	//
   123  	// min items: 3
   124  	// max items: 10
   125  	// unique: true
   126  	// items.minItems: 4
   127  	// items.maxItems: 9
   128  	// items.items.minItems: 5
   129  	// items.items.maxItems: 8
   130  	DeepTimeSlice [][][]time.Time `json:"deep_time_slice"`
   131  
   132  	// the items for this order
   133  	Items []struct {
   134  		// ID of this no model instance.
   135  		// ids in this application start at 11 and are smaller than 1000
   136  		//
   137  		// required: true
   138  		// minimum: > 10
   139  		// maximum: < 1000
   140  		// default: 11
   141  		ID int32 `json:"id"`
   142  
   143  		// The Pet to add to this NoModel items bucket.
   144  		// Pets can appear more than once in the bucket
   145  		//
   146  		// required: true
   147  		Pet *mods.Pet `json:"pet"`
   148  
   149  		// The amount of pets to add to this bucket.
   150  		//
   151  		// required: true
   152  		// minimum: 1
   153  		// maximum: 10
   154  		Quantity int16 `json:"quantity"`
   155  
   156  		// A dummy expiration date.
   157  		//
   158  		// required: true
   159  		Expiration time.Time `json:"expiration"`
   160  
   161  		// Notes to add to this item.
   162  		// This can be used to add special instructions.
   163  		//
   164  		// required: false
   165  		Notes string `json:"notes"`
   166  
   167  		AlsoIgnored string `json:"-"`
   168  	} `json:"items"`
   169  }
   170  
   171  // A OtherTypes struct contains type aliases
   172  type OtherTypes struct {
   173  	Named       SomeStringType     `json:"named"`
   174  	Numbered    SomeIntType        `json:"numbered"`
   175  	Dated       SomeTimeType       `json:"dated"`
   176  	Timed       SomeTimedType      `json:"timed"`
   177  	Petted      SomePettedType     `json:"petted"`
   178  	Somethinged SomethingType      `json:"somethinged"`
   179  	StrMap      SomeStringMap      `json:"strMap"`
   180  	StrArrMap   SomeArrayStringMap `json:"strArrMap"`
   181  
   182  	ManyNamed       SomeStringsType `json:"manyNamed"`
   183  	ManyNumbered    SomeIntsType    `json:"manyNumbered"`
   184  	ManyDated       SomeTimesType   `json:"manyDated"`
   185  	ManyTimed       SomeTimedsType  `json:"manyTimed"`
   186  	ManyPetted      SomePettedsType `json:"manyPetted"`
   187  	ManySomethinged SomethingsType  `json:"manySomethinged"`
   188  
   189  	Nameds       []SomeStringType `json:"nameds"`
   190  	Numbereds    []SomeIntType    `json:"numbereds"`
   191  	Dateds       []SomeTimeType   `json:"dateds"`
   192  	Timeds       []SomeTimedType  `json:"timeds"`
   193  	Petteds      []SomePettedType `json:"petteds"`
   194  	Somethingeds []SomethingType  `json:"somethingeds"`
   195  
   196  	ModsNamed    mods.SomeStringType `json:"modsNamed"`
   197  	ModsNumbered mods.SomeIntType    `json:"modsNumbered"`
   198  	ModsDated    mods.SomeTimeType   `json:"modsDated"`
   199  	ModsTimed    mods.SomeTimedType  `json:"modsTimed"`
   200  	ModsPetted   mods.SomePettedType `json:"modsPetted"`
   201  
   202  	ModsNameds    []mods.SomeStringType `json:"modsNameds"`
   203  	ModsNumbereds []mods.SomeIntType    `json:"modsNumbereds"`
   204  	ModsDateds    []mods.SomeTimeType   `json:"modsDateds"`
   205  	ModsTimeds    []mods.SomeTimedType  `json:"modsTimeds"`
   206  	ModsPetteds   []mods.SomePettedType `json:"modsPetteds"`
   207  
   208  	ManyModsNamed     mods.SomeStringsType    `json:"manyModsNamed"`
   209  	ManyModsNumbered  mods.SomeIntsType       `json:"manyModsNumbered"`
   210  	ManyModsDated     mods.SomeTimesType      `json:"manyModsDated"`
   211  	ManyModsTimed     mods.SomeTimedsType     `json:"manyModsTimed"`
   212  	ManyModsPetted    mods.SomePettedsType    `json:"manyModsPetted"`
   213  	ManyModsPettedPtr mods.SomePettedsPtrType `json:"manyModsPettedPtr"`
   214  
   215  	NamedAlias     SomeStringTypeAlias   `json:"namedAlias"`
   216  	NumberedAlias  SomeIntTypeAlias      `json:"numberedAlias"`
   217  	NamedsAlias    []SomeStringTypeAlias `json:"namedsAlias"`
   218  	NumberedsAlias []SomeIntTypeAlias    `json:"numberedsAlias"`
   219  }
   220  
   221  // A SimpleOne is a model with a few simple fields
   222  type SimpleOne struct {
   223  	ID   int64  `json:"id"`
   224  	Name string `json:"name"`
   225  	Age  int32  `json:"age"`
   226  }
   227  
   228  // A ComplexerOne is composed of a SimpleOne and some extra fields
   229  type ComplexerOne struct {
   230  	SimpleOne
   231  	mods.NotSelected
   232  	mods.Notable
   233  	CreatedAt strfmt.DateTime `json:"createdAt"`
   234  }
   235  
   236  // An OverridingOne is composed of a SimpleOne and overrides a field
   237  type OverridingOne struct {
   238  	SimpleOne
   239  	Age int64
   240  }
   241  
   242  // An OverridingOneIgnore is composed of a SimpleOne and overrides a field to ignore it
   243  type OverridingOneIgnore struct {
   244  	SimpleOne
   245  	Age int32 `json:"-"`
   246  }
   247  
   248  // An AllOfModel is composed out of embedded structs but it should build
   249  // an allOf property
   250  type AllOfModel struct {
   251  	// swagger:allOf
   252  	SimpleOne
   253  	// swagger:allOf
   254  	mods.Notable
   255  
   256  	Something // not annotated with anything, so should be included
   257  
   258  	CreatedAt strfmt.DateTime `json:"createdAt"`
   259  }
   260  
   261  // An Embedded is to be embedded in EmbeddedStarExpr
   262  type Embedded struct {
   263  	EmbeddedMember int64 `json:"embeddedMember"`
   264  }
   265  
   266  // An EmbeddedStarExpr for testing the embedded StarExpr
   267  type EmbeddedStarExpr struct {
   268  	*Embedded
   269  	NotEmbedded int64 `json:"notEmbedded"`
   270  }
   271  
   272  // A PrimateModel is a struct with nothing but builtins.
   273  //
   274  // It only has values 1 level deep and each of those is of a very simple
   275  // builtin type.
   276  type PrimateModel struct {
   277  	A bool `json:"a"`
   278  
   279  	B rune   `json:"b"`
   280  	C string `json:"c"`
   281  
   282  	D int   `json:"d"`
   283  	E int8  `json:"e"`
   284  	F int16 `json:"f"`
   285  	G int32 `json:"g"`
   286  	H int64 `json:"h"`
   287  
   288  	I uint   `json:"i"`
   289  	J uint8  `json:"j"`
   290  	K uint16 `json:"k"`
   291  	L uint32 `json:"l"`
   292  	M uint64 `json:"m"`
   293  
   294  	N float32 `json:"n"`
   295  	O float64 `json:"o"`
   296  
   297  	P byte `json:"p"`
   298  
   299  	Q uintptr `json:"q"`
   300  }
   301  
   302  // A FormattedModel is a struct with only strfmt types
   303  //
   304  // It only has values 1 level deep and is used for testing the conversion
   305  type FormattedModel struct {
   306  	A strfmt.Base64     `json:"a"`
   307  	B strfmt.CreditCard `json:"b"`
   308  	C strfmt.Date       `json:"c"`
   309  	D strfmt.DateTime   `json:"d"`
   310  	E strfmt.Duration   `json:"e"`
   311  	F strfmt.Email      `json:"f"`
   312  	G strfmt.HexColor   `json:"g"`
   313  	H strfmt.Hostname   `json:"h"`
   314  	I strfmt.IPv4       `json:"i"`
   315  	J strfmt.IPv6       `json:"j"`
   316  	K strfmt.ISBN       `json:"k"`
   317  	L strfmt.ISBN10     `json:"l"`
   318  	M strfmt.ISBN13     `json:"m"`
   319  	N strfmt.RGBColor   `json:"n"`
   320  	O strfmt.SSN        `json:"o"`
   321  	P strfmt.URI        `json:"p"`
   322  	Q strfmt.UUID       `json:"q"`
   323  	R strfmt.UUID3      `json:"r"`
   324  	S strfmt.UUID4      `json:"s"`
   325  	T strfmt.UUID5      `json:"t"`
   326  	U strfmt.MAC        `json:"u"`
   327  }
   328  
   329  // A SimpleComplexModel is a struct with only other struct types
   330  //
   331  // It doesn't have slices or arrays etc but only complex types
   332  // so also no primitives or string formatters
   333  type SimpleComplexModel struct {
   334  	Top Something `json:"top"`
   335  
   336  	NotSel mods.NotSelected `json:"notSel"`
   337  
   338  	Emb struct {
   339  		CID int64  `json:"cid"`
   340  		Baz string `json:"baz"`
   341  	} `json:"emb"`
   342  }
   343  
   344  // Pointdexter is a struct with only pointers
   345  type Pointdexter struct {
   346  	ID   *int64        `json:"id"`
   347  	Name *string       `json:"name"`
   348  	T    *strfmt.UUID5 `json:"t"`
   349  	Top  *Something    `json:"top"`
   350  
   351  	NotSel *mods.NotSelected `json:"notSel"`
   352  
   353  	Emb *struct {
   354  		CID *int64  `json:"cid"`
   355  		Baz *string `json:"baz"`
   356  	} `json:"emb"`
   357  }
   358  
   359  // A SliceAndDice struct contains only slices
   360  //
   361  // the elements of the slices are structs, primitives or string formats
   362  // there is also a pointer version of each property
   363  type SliceAndDice struct {
   364  	IDs     []int64            `json:"ids"`
   365  	Names   []string           `json:"names"`
   366  	UUIDs   []strfmt.UUID      `json:"uuids"`
   367  	Tops    []Something        `json:"tops"`
   368  	NotSels []mods.NotSelected `json:"notSels"`
   369  	Embs    []struct {
   370  		CID []int64  `json:"cid"`
   371  		Baz []string `json:"baz"`
   372  	} `json:"embs"`
   373  
   374  	PtrIDs     []*int64            `json:"ptrIds"`
   375  	PtrNames   []*string           `json:"ptrNames"`
   376  	PtrUUIDs   []*strfmt.UUID      `json:"ptrUuids"`
   377  	PtrTops    []*Something        `json:"ptrTops"`
   378  	PtrNotSels []*mods.NotSelected `json:"ptrNotSels"`
   379  	PtrEmbs    []*struct {
   380  		PtrCID []*int64  `json:"ptrCid"`
   381  		PtrBaz []*string `json:"ptrBaz"`
   382  	} `json:"ptrEmbs"`
   383  }
   384  
   385  // A MapTastic struct contains only maps
   386  //
   387  // the values of the maps are structs, primitives or string formats
   388  // there is also a pointer version of each property
   389  type MapTastic struct {
   390  	IDs     map[string]int64            `json:"ids"`
   391  	Names   map[string]string           `json:"names"`
   392  	UUIDs   map[string]strfmt.UUID      `json:"uuids"`
   393  	Tops    map[string]Something        `json:"tops"`
   394  	NotSels map[string]mods.NotSelected `json:"notSels"`
   395  	Embs    map[string]struct {
   396  		CID map[string]int64  `json:"cid"`
   397  		Baz map[string]string `json:"baz"`
   398  	} `json:"embs"`
   399  
   400  	PtrIDs     map[string]*int64            `json:"ptrIds"`
   401  	PtrNames   map[string]*string           `json:"ptrNames"`
   402  	PtrUUIDs   map[string]*strfmt.UUID      `json:"ptrUuids"`
   403  	PtrTops    map[string]*Something        `json:"ptrTops"`
   404  	PtrNotSels map[string]*mods.NotSelected `json:"ptrNotSels"`
   405  	PtrEmbs    map[string]*struct {
   406  		PtrCID map[string]*int64  `json:"ptrCid"`
   407  		PtrBaz map[string]*string `json:"ptrBaz"`
   408  	} `json:"ptrEmbs"`
   409  }
   410  
   411  // An Interfaced struct contains objects with interface definitions
   412  type Interfaced struct {
   413  	CustomData interface{} `json:"custom_data"`
   414  }
   415  
   416  // A BaseStruct is a struct that has subtypes.
   417  //
   418  // it should deserialize into one of the struct types that
   419  // enlist for being implementations of this struct
   420  //
   421  // swagger:model animal
   422  type BaseStruct struct {
   423  	// ID of this no model instance.
   424  	// ids in this application start at 11 and are smaller than 1000
   425  	//
   426  	// required: true
   427  	// minimum: > 10
   428  	// maximum: < 1000
   429  	ID int64 `json:"id"`
   430  
   431  	// Name of this no model instance
   432  	//
   433  	// min length: 4
   434  	// max length: 50
   435  	// pattern: [A-Za-z0-9-.]*
   436  	// required: true
   437  	Name string `json:"name"`
   438  
   439  	// StructType the type of this polymorphic model
   440  	//
   441  	// discriminator: true
   442  	StructType string `json:"jsonClass"`
   443  }
   444  
   445  /* TODO: implement this in the scanner
   446  
   447  // A Lion is a struct that "subtypes" the BaseStruct
   448  //
   449  // it does so because it included the fields in the struct body
   450  // The scanner assumes it will follow the rules and describes this type
   451  // as discriminated in the swagger spec based on the discriminator value
   452  // annotation.
   453  //
   454  // swagger:model lion
   455  // swagger:discriminatorValue animal org.horrible.java.fqpn.TheLionDataObjectFactoryInstanceServiceImpl
   456  type Lion struct {
   457  	// ID of this no model instance.
   458  	// ids in this application start at 11 and are smaller than 1000
   459  	//
   460  	// required: true
   461  	// minimum: > 10
   462  	// maximum: < 1000
   463  	ID int64 `json:"id"`
   464  
   465  	// Name of this no model instance
   466  	//
   467  	// min length: 4
   468  	// max length: 50
   469  	// pattern: [A-Za-z0-9-.]*
   470  	// required: true
   471  	Name string `json:"name"`
   472  
   473  	// StructType the type of this polymorphic model
   474  	StructType string `json:"jsonClass"`
   475  
   476  	// Leader is true when this is the leader of its group
   477  	//
   478  	// default value: false
   479  	Leader bool `json:"leader"`
   480  }
   481  */
   482  
   483  // A Giraffe is a struct that embeds BaseStruct
   484  //
   485  // the annotation is not necessary here because of inclusion
   486  // of a discriminated type
   487  // it infers the name of the x-class value from its context
   488  //
   489  // swagger:model giraffe
   490  type Giraffe struct {
   491  	// swagger:allOf
   492  	BaseStruct
   493  
   494  	// NeckSize the size of the neck of this giraffe
   495  	NeckSize int64 `json:"neckSize"`
   496  }
   497  
   498  // A Gazelle is a struct is discriminated for BaseStruct.
   499  //
   500  // The struct includes the BaseStruct and that embedded value
   501  // is annotated with the discriminator value annotation so it
   502  // where it only requires 1 argument because it knows which
   503  // discriminator type this belongs to
   504  //
   505  // swagger:model gazelle
   506  type Gazelle struct {
   507  	// swagger:allOf a.b.c.d.E
   508  	BaseStruct
   509  
   510  	// The size of the horns
   511  	HornSize float32 `json:"hornSize"`
   512  }
   513  
   514  // Identifiable is an interface for things that have an ID
   515  type Identifiable interface {
   516  	// ID of this no model instance.
   517  	// ids in this application start at 11 and are smaller than 1000
   518  	//
   519  	// required: true
   520  	// minimum: > 10
   521  	// maximum: < 1000
   522  	// swagger:name id
   523  	ID() int64
   524  }
   525  
   526  // WaterType is an interface describing a water type
   527  //
   528  // swagger:model water
   529  type WaterType interface {
   530  	// swagger:name sweetWater
   531  	SweetWater() bool
   532  	// swagger:name saltWater
   533  	SaltWater() bool
   534  }
   535  
   536  // Fish represents a base type implemented as interface
   537  // the nullary methods of this interface will be included as
   538  //
   539  // swagger:model fish
   540  type Fish interface {
   541  	Identifiable // interfaces like this are included as if they were defined directly on this type
   542  
   543  	// embeds decorated with allOf are included as refs
   544  
   545  	// swagger:allOf
   546  	WaterType
   547  
   548  	// swagger:allOf
   549  	mods.ExtraInfo
   550  
   551  	mods.EmbeddedColor
   552  
   553  	Items(id, size int64) []string
   554  
   555  	// Name of this no model instance
   556  	//
   557  	// min length: 4
   558  	// max length: 50
   559  	// pattern: [A-Za-z0-9-.]*
   560  	// required: true
   561  	// swagger:name name
   562  	Name() string
   563  
   564  	// StructType the type of this polymorphic model
   565  	// Discriminator: true
   566  	// swagger:name jsonClass
   567  	StructType() string
   568  }
   569  
   570  // TeslaCar is a tesla car
   571  //
   572  // swagger:model
   573  type TeslaCar interface {
   574  	// The model of tesla car
   575  	//
   576  	// discriminated: true
   577  	// swagger:name model
   578  	Model() string
   579  
   580  	// AutoPilot returns true when it supports autopilot
   581  	// swagger:name autoPilot
   582  	AutoPilot() bool
   583  }
   584  
   585  // The ModelS version of the tesla car
   586  //
   587  // swagger:model modelS
   588  type ModelS struct {
   589  	// swagger:allOf com.tesla.models.ModelS
   590  	TeslaCar
   591  	// The edition of this Model S
   592  	Edition string `json:"edition"`
   593  }
   594  
   595  // Test proper parsing of type declaration _blocks_:
   596  type (
   597  	// The ModelX version of the tesla car
   598  	//
   599  	// swagger:model modelX
   600  	ModelX struct {
   601  		// swagger:allOf com.tesla.models.ModelX
   602  		TeslaCar
   603  		// The number of doors on this Model X
   604  		Doors int `json:"doors"`
   605  	}
   606  
   607  	// The ModelA version of the tesla car
   608  	//
   609  	// swagger:model modelA
   610  	ModelA struct {
   611  		Tesla TeslaCar
   612  		// The number of doors on this Model A
   613  		Doors int `json:"doors"`
   614  	}
   615  )
   616  
   617  // Cars is a collection of cars
   618  //
   619  // swagger:model cars
   620  type Cars struct {
   621  	Cars []*TeslaCar `json:"cars"`
   622  }
   623  
   624  // JSONString has fields with ",string" JSON directives.
   625  //
   626  // swagger:model jsonString
   627  type JSONString struct {
   628  	// Should be encoded as a string with string format "integer"
   629  	SomeInt    int    `json:"someInt,string"`
   630  	SomeInt8   int8   `json:"someInt8,string"`
   631  	SomeInt16  int16  `json:"someInt16,string"`
   632  	SomeInt32  int32  `json:"someInt32,string"`
   633  	SomeInt64  int64  `json:"someInt64,string"`
   634  	SomeUint   uint   `json:"someUint,string"`
   635  	SomeUint8  uint8  `json:"someUint8,string"`
   636  	SomeUint16 uint16 `json:"someUint16,string"`
   637  	SomeUint32 uint32 `json:"someUint32,string"`
   638  	SomeUint64 uint64 `json:"someUint64,string"`
   639  
   640  	// Should be encoded as a string with string format "double"
   641  	SomeFloat64 float64 `json:"someFloat64,string"`
   642  
   643  	// Should be encoded as a string with no format
   644  	SomeString string `json:"someString,string"`
   645  
   646  	// Should be encoded as a string with no format
   647  	SomeBool bool `json:"someBool,string"`
   648  
   649  	// The ",string" directive should be ignore before the type isn't scalar
   650  	SomethingElse Cars `json:"somethingElse,string"`
   651  
   652  	// The ",omitempty,string" directive should be valid
   653  	SomeDefaultInt int `json:",omitempty,string"`
   654  }
   655  
   656  // JSONPtrString has fields with ",string" JSON directives.
   657  //
   658  // swagger:model jsonPtrString
   659  type JSONPtrString struct {
   660  	// Should be encoded as a string with string format "integer"
   661  	SomeInt    *int    `json:"someInt,string"`
   662  	SomeInt8   *int8   `json:"someInt8,string"`
   663  	SomeInt16  *int16  `json:"someInt16,string"`
   664  	SomeInt32  *int32  `json:"someInt32,string"`
   665  	SomeInt64  *int64  `json:"someInt64,string"`
   666  	SomeUint   *uint   `json:"someUint,string"`
   667  	SomeUint8  *uint8  `json:"someUint8,string"`
   668  	SomeUint16 *uint16 `json:"someUint16,string"`
   669  	SomeUint32 *uint32 `json:"someUint32,string"`
   670  	SomeUint64 *uint64 `json:"someUint64,string"`
   671  
   672  	// Should be encoded as a string with string format "double"
   673  	SomeFloat64 *float64 `json:"someFloat64,string"`
   674  
   675  	// Should be encoded as a string with no format
   676  	SomeString *string `json:"someString,string"`
   677  
   678  	// Should be encoded as a string with no format
   679  	SomeBool *bool `json:"someBool,string"`
   680  
   681  	// The ",string" directive should be ignore before the type isn't scalar
   682  	SomethingElse *Cars `json:"somethingElse,string"`
   683  }
   684  
   685  // IgnoredFields demostrates the use of swagger:ignore on struct fields.
   686  //
   687  // swagger:model ignoredFields
   688  type IgnoredFields struct {
   689  	SomeIncludedField string `json:"someIncludedField"`
   690  
   691  	// swagger:ignore
   692  	SomeIgnoredField string `json:"someIgnoredField"`
   693  
   694  	// This swagger:ignore tag won't work - it needs to be in the field's doc
   695  	// block
   696  	SomeErroneouslyIncludedField string `json:"someErroneouslyIncludedField"` // swagger:ignore
   697  }
   698  
   699  // UUID is a type that represents a UUID as a string
   700  type UUID [16]byte
   701  
   702  func (uuid UUID) MarshalText() ([]byte, error) {
   703  	return []byte("hola desde UUID"), nil
   704  }
   705  
   706  type MarshalTextStruct struct {
   707  	Hola string
   708  }
   709  
   710  func (cm MarshalTextStruct) MarshalText() ([]byte, error) {
   711  	return []byte("hi from CustomStruct"), nil
   712  }
   713  
   714  type MarshalTextMap map[string]interface{}
   715  
   716  func (cm MarshalTextMap) MarshalText() ([]byte, error) {
   717  	return []byte("hola desde CustomMap"), nil
   718  }
   719  
   720  // swagger:strfmt date-time
   721  type MarshalTextStructStrfmt struct {
   722  	Foo string `json:"foo"`
   723  }
   724  
   725  func (cm MarshalTextStructStrfmt) MarshalText() ([]byte, error) {
   726  	return []byte("hi from CustomStructStrfmt"), nil
   727  }
   728  
   729  // swagger:strfmt date-time
   730  type MarshalTextStructStrfmtPtr struct {
   731  	Foo string `json:"foo"`
   732  }
   733  
   734  func (cm MarshalTextStructStrfmtPtr) MarshalText() ([]byte, error) {
   735  	return []byte("hi frome CustomStructStrfmtPtr"), nil
   736  }
   737  
   738  // swagger:strfmt url
   739  type URL url.URL
   740  
   741  // TextMarshalModel demostrates the use of MarshalText from different fields
   742  //
   743  // swagger:model TextMarshalModel
   744  type TextMarshalModel struct {
   745  	ID              UUID                        `json:"id"`
   746  	IDs             []UUID                      `json:"ids"`
   747  	Struct          MarshalTextStruct           `json:"struct"`
   748  	Map             MarshalTextMap              `json:"map"`
   749  	MapUUID         map[string]UUID             `json:"mapUUID"`
   750  	URL             url.URL                     `json:"url"` // url.URL not has TextMarshal!
   751  	Time            time.Time                   `json:"time"`
   752  	StructStrfmt    MarshalTextStructStrfmt     `json:"structStrfmt"`
   753  	StructStrfmtPtr *MarshalTextStructStrfmtPtr `json:"structStrfmtPtr"`
   754  	CustomURL       URL                         `json:"customUrl"`
   755  }
   756  
   757  // swagger:type object
   758  type SomeObjectMap interface{}
   759  
   760  // swagger:model namedWithType
   761  type NamedWithType struct {
   762  	SomeMap SomeObjectMap `json:"some_map"`
   763  }