github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/fixtures/goparsing/classification/operations/responses.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  	"github.com/go-openapi/strfmt"
    19  	"github.com/go-swagger/go-swagger/fixtures/goparsing/classification/transitive/mods"
    20  )
    21  
    22  // A GenericError is an error that is used when no other error is appropriate
    23  // swagger:response genericError
    24  type GenericError struct {
    25  	// The error message
    26  	// in: body
    27  	Body struct {
    28  		Message string
    29  	}
    30  }
    31  
    32  // MyOwnFunc contains a response inside it.
    33  func MyOwnFunc() {
    34  	// SimpleOnesFunc is a collection of SimpleOne
    35  	// swagger:response simpleOnesFunc
    36  	type SimpleOnesFunc struct {
    37  		Ones []*SimpleOne `json:"ones"`
    38  	}
    39  }
    40  
    41  // A ValidationError is an error that is used when the required input fails validation.
    42  // swagger:response validationError
    43  type ValidationError struct {
    44  	// in: header
    45  	// enum: foo,bar
    46  	// default: 400
    47  	Code int `json:"code"`
    48  
    49  	// The error message
    50  	// in: body
    51  	Body struct {
    52  		// The validation message
    53  		Message string
    54  		// An optional field name to which this validation applies
    55  		FieldName string
    56  	}
    57  }
    58  
    59  // A SimpleOne is a model with a few simple fields
    60  type SimpleOne struct {
    61  	ID   int64  `json:"id"`
    62  	Name string `json:"name"`
    63  	Age  int32  `json:"age"`
    64  }
    65  
    66  // SimpleOnes is a collection of SimpleOne
    67  // swagger:response simpleOnes
    68  type SimpleOnes struct {
    69  	Ones []*SimpleOne `json:"ones"`
    70  }
    71  
    72  // A ComplexerOne is composed of a SimpleOne and some extra fields.
    73  // swagger:response complexerOne
    74  type ComplexerOne struct {
    75  	SimpleOne
    76  	mods.NotSelected
    77  	mods.Notable
    78  	CreatedAt strfmt.DateTime `json:"createdAt"`
    79  	NoTagName string          `json:",omitempty"`
    80  }
    81  
    82  // A ComplexerPointerOne is composed of a *SimpleOne and some extra fields.
    83  // swagger:response complexerPointerOne
    84  type ComplexerPointerOne struct {
    85  	*SimpleOne
    86  	Extra int64 `json:"extra"`
    87  }
    88  
    89  // A SomeResponse is a dummy response object to test parsing.
    90  //
    91  // The properties are the same as the other structs used to test parsing.
    92  //
    93  // swagger:response someResponse
    94  type SomeResponse struct {
    95  	// ID of this some response instance.
    96  	// ids in this application start at 11 and are smaller than 1000
    97  	//
    98  	// minimum: > 10
    99  	// maximum: < 1000
   100  	// default: 11
   101  	ID int64 `json:"id"`
   102  
   103  	// The Score of this model
   104  	//
   105  	// minimum: 3
   106  	// maximum: 45
   107  	// multiple of: 3
   108  	// example: 27
   109  	Score int32 `json:"score"`
   110  
   111  	// Active state of the record
   112  	//
   113  	// default: true
   114  	Active bool `json:"active"`
   115  
   116  	// Name of this some response instance
   117  	//
   118  	// min length: 4
   119  	// max length: 50
   120  	// pattern: [A-Za-z0-9-.]*
   121  	Name string `json:"x-hdr-name"`
   122  
   123  	// Created holds the time when this entry was created
   124  	Created strfmt.DateTime `json:"created"`
   125  
   126  	// a FooSlice has foos which are strings
   127  	//
   128  	// min items: 3
   129  	// max items: 10
   130  	// unique: true
   131  	// items.minLength: 3
   132  	// items.maxLength: 10
   133  	// items.pattern: \w+
   134  	// items.example: foo
   135  	// collection format: pipe
   136  	FooSlice []string `json:"foo_slice"`
   137  
   138  	// a BarSlice has bars which are strings
   139  	//
   140  	// min items: 3
   141  	// max items: 10
   142  	// unique: true
   143  	// items.minItems: 4
   144  	// items.maxItems: 9
   145  	// items.items.minItems: 5
   146  	// items.items.maxItems: 8
   147  	// items.items.items.minLength: 3
   148  	// items.items.items.maxLength: 10
   149  	// items.items.items.pattern: \w+
   150  	// collection format: pipe
   151  	BarSlice [][][]string `json:"bar_slice"`
   152  
   153  	// the items for this order
   154  	//
   155  	// in: body
   156  	Items []struct {
   157  		// ID of this some response instance.
   158  		// ids in this application start at 11 and are smaller than 1000
   159  		//
   160  		// required: true
   161  		// minimum: > 10
   162  		// maximum: < 1000
   163  		ID int32 `json:"id"`
   164  
   165  		// The Pet to add to this NoModel items bucket.
   166  		// Pets can appear more than once in the bucket
   167  		//
   168  		// required: true
   169  		Pet *mods.Pet `json:"pet"`
   170  
   171  		// The amount of pets to add to this bucket.
   172  		//
   173  		// required: true
   174  		// minimum: 1
   175  		// maximum: 10
   176  		Quantity int16 `json:"quantity"`
   177  
   178  		// Notes to add to this item.
   179  		// This can be used to add special instructions.
   180  		//
   181  		// required: false
   182  		Notes string `json:"notes"`
   183  	} `json:"items"`
   184  }
   185  
   186  type user struct {
   187  	// ID of this some response instance.
   188  	// ids in this application start at 11 and are smaller than 1000
   189  	//
   190  	// required: true
   191  	UserName string `json:"id"`
   192  }
   193  
   194  // Resp a response for testing
   195  //
   196  // swagger:response resp
   197  type Resp struct {
   198  	// in: body
   199  	Body *user `json:"user"`
   200  
   201  	// swagger:strfmt uuid
   202  	UUID string
   203  }
   204  
   205  // File response
   206  //
   207  // swagger:response fileResponse
   208  type FileResponse struct {
   209  	// swagger:file
   210  	// in:  body
   211  	File []byte
   212  }
   213  
   214  // Success
   215  // swagger:response GetConfiguration
   216  type GetConfiguration struct {
   217  	// in:body
   218  	Value map[string]string
   219  }
   220  
   221  // swagger:response
   222  type NumPlatesResp struct {
   223  	// in: body
   224  	NumPlates interface{} `json:"num_plates"`
   225  }