github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/fixtures/goparsing/classification/operations/noparams.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 operations
    16  
    17  import (
    18  	"bytes"
    19  
    20  	"github.com/go-openapi/strfmt"
    21  	"github.com/go-swagger/go-swagger/fixtures/goparsing/classification/models"
    22  	"github.com/go-swagger/go-swagger/fixtures/goparsing/classification/transitive/mods"
    23  )
    24  
    25  // MyFileParams contains the uploaded file data
    26  // swagger:parameters myOperation
    27  type MyFileParams struct {
    28  	// MyFormFile desc.
    29  	//
    30  	// in: formData
    31  	//
    32  	// swagger:file
    33  	MyFormFile *bytes.Buffer `json:"myFormFile"`
    34  }
    35  
    36  // MyFunc contains a struct with parameters.
    37  func MyFunc() {
    38  	// MyFuncFileParams contains the uploaded file data in a function.
    39  	// swagger:parameters myFuncOperation
    40  	type MyFuncFileParams struct {
    41  		// MyFormFile desc.
    42  		//
    43  		// in: formData
    44  		//
    45  		// swagger:file
    46  		MyFormFile *bytes.Buffer `json:"myFormFile"`
    47  	}
    48  }
    49  
    50  // EmbeddedFileParams embeds a *MyFileParams
    51  // swagger:parameters myOtherOperation
    52  type EmbeddedFileParams struct {
    53  	*MyFileParams
    54  
    55  	// ExtraParam desc.
    56  	// in: formData
    57  	// required: true
    58  	ExtraParam int `json:"extraParam"`
    59  }
    60  
    61  // An OrderBodyParams model.
    62  //
    63  // This is used for operations that want an Order as body of the request
    64  // swagger:parameters updateOrder
    65  // swagger:parameters createOrder
    66  type OrderBodyParams struct {
    67  	// The order to submit.
    68  	//
    69  	// in: body
    70  	// required: true
    71  	Order *models.StoreOrder `json:"order"`
    72  }
    73  
    74  // An MultipleOrderParams model.
    75  //
    76  // This is used for operations that want multiple orders as the body
    77  // swagger:parameters getOrders
    78  type MultipleOrderParams struct {
    79  	// The orders
    80  	// required: true
    81  	Orders []*OrderBodyParams `json:"orders"`
    82  
    83  	// And another thing
    84  	// in: body
    85  	Another []struct {
    86  		That string `json:"that"`
    87  	} `json:"another"`
    88  }
    89  
    90  // Success
    91  // swagger:parameters getConfiguration
    92  type SetConfiguration struct {
    93  	// in:body
    94  	Value map[string]string
    95  }
    96  
    97  // swagger:parameters putNumPlate
    98  type NumPlates struct {
    99  	// in: body
   100  	NumPlates interface{} `json:"num_plates"`
   101  }
   102  
   103  // A ComplexerOneParams is composed of a SimpleOne and some extra fields
   104  // swagger:parameters yetAnotherOperation
   105  type ComplexerOneParams struct {
   106  	SimpleOne
   107  	mods.NotSelected
   108  	mods.Notable
   109  	CreatedAt strfmt.DateTime `json:"createdAt"`
   110  	Secret    string          `json:"-"`
   111  
   112  	// in: formData
   113  	Informity string `json:"informity"`
   114  
   115  	NoTagName string `json:",omitempty"`
   116  }
   117  
   118  // NoParams is a struct that exists in a package
   119  // but is not annotated with the swagger params annotations
   120  // so it should now show up in a test
   121  //
   122  // swagger:parameters someOperation
   123  // swagger:parameters anotherOperation
   124  type NoParams struct {
   125  	// ID of this no model instance.
   126  	// ids in this application start at 11 and are smaller than 1000
   127  	//
   128  	// required: true
   129  	// minimum: > 10
   130  	// maximum: < 1000
   131  	// in: path
   132  	// default: 1
   133  	ID int64 `json:"id"`
   134  
   135  	// The Score of this model
   136  	//
   137  	// required: true
   138  	// minimum: 3
   139  	// maximum: 45
   140  	// multiple of: 3
   141  	// in: query
   142  	// default: 2
   143  	// example: 27
   144  	Score int32 `json:"score"`
   145  
   146  	// Name of this no model instance
   147  	//
   148  	// min length: 4
   149  	// max length: 50
   150  	// pattern: [A-Za-z0-9-.]*
   151  	// required: true
   152  	// in: header
   153  	Name string `json:"x-hdr-name"`
   154  
   155  	// Created holds the time when this entry was created
   156  	//
   157  	// required: false
   158  	// in: query
   159  	Created strfmt.DateTime `json:"created"`
   160  
   161  	// The Category of this model
   162  	//
   163  	// required: true
   164  	// enum: foo,bar,none
   165  	// default: bar
   166  	// in: query
   167  	Category string `json:"category"`
   168  
   169  	// Type of this model
   170  	//
   171  	// enum: 1,3,5
   172  	// default: 1
   173  	// in: query
   174  	Type int `json:"type"`
   175  
   176  	// This is mix in enum. And actually on output should be valid form where int will be int and
   177  	// string will also be presented.
   178  	//
   179  	// enum: 1,rsq,qaz
   180  	// in: query
   181  	BadEnum int `json:"bad_enum"`
   182  
   183  	// a FooSlice has foos which are strings
   184  	//
   185  	// min items: 3
   186  	// max items: 10
   187  	// unique: true
   188  	// items.minLength: 3
   189  	// items.maxLength: 10
   190  	// items.pattern: \w+
   191  	// collection format: pipe
   192  	// items.default: bar
   193  	// in: query
   194  	FooSlice []string `json:"foo_slice"`
   195  
   196  	// a BarSlice has bars which are strings
   197  	//
   198  	// min items: 3
   199  	// max items: 10
   200  	// unique: true
   201  	// items.minItems: 4
   202  	// items.maxItems: 9
   203  	// items.enum: bar1,bar2,bar3
   204  	// items.default: bar2
   205  	// items.items.minItems: 5
   206  	// items.items.maxItems: 8
   207  	// items.items.items.minLength: 3
   208  	// items.items.items.maxLength: 10
   209  	// items.items.items.pattern: \w+
   210  	// collection format: pipe
   211  	// in: query
   212  	BarSlice [][][]string `json:"bar_slice"`
   213  
   214  	// the items for this order
   215  	//
   216  	// in: body
   217  	Items []struct {
   218  		// ID of this no model instance.
   219  		// ids in this application start at 11 and are smaller than 1000
   220  		//
   221  		// required: true
   222  		// minimum: > 10
   223  		// maximum: < 1000
   224  		// default: 3
   225  		ID int32 `json:"id"`
   226  
   227  		// The Pet to add to this NoModel items bucket.
   228  		// Pets can appear more than once in the bucket
   229  		//
   230  		// required: true
   231  		Pet *mods.Pet `json:"pet"`
   232  
   233  		// The amount of pets to add to this bucket.
   234  		//
   235  		// required: true
   236  		// minimum: 1
   237  		// maximum: 10
   238  		Quantity int16 `json:"quantity"`
   239  
   240  		// Notes to add to this item.
   241  		// This can be used to add special instructions.
   242  		//
   243  		//
   244  		// required: false
   245  		Notes string `json:"notes"`
   246  	} `json:"items"`
   247  }
   248  
   249  // NoParamsAlias is a struct that exists in a package
   250  // but is not annotated with the swagger params annotations
   251  // so it should now show up in a test
   252  //
   253  // swagger:parameters someAliasOperation
   254  type NoParamsAlias struct {
   255  	// default "in" is "query" => this params should be aliased
   256  	// required: true
   257  	// minimum: 1
   258  	// maximum: 10
   259  	IntAlias    SomeIntType    `json:"intAlias"`
   260  	StringAlias SomeStringType `json:"stringAlias"`
   261  	// in: path
   262  	IntAliasPath SomeIntType `json:"intAliasPath"`
   263  	// in: formData
   264  	IntAliasForm SomeIntType `json:"intAliasForm"`
   265  }
   266  
   267  // SomeStringType is a type that refines string
   268  type SomeStringType string
   269  
   270  // SomeIntType is a type that refines int64
   271  type SomeIntType int64