github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/fixtures/goparsing/classification/operations_annotation/operations.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  // ServeAPI serves the API for this record store
    18  func ServeAPI(host, basePath string, schemes []string) (err error) {
    19  	// swagger:operation GET /pets pets getPet
    20  	//
    21  	// List all pets
    22  	//
    23  	// ---
    24  	// parameters:
    25  	//   - name: limit
    26  	//     in: query
    27  	//     description: How many items to return at one time (max 100)
    28  	//     required: false
    29  	//     type: integer
    30  	//     format: int32
    31  	// consumes:
    32  	//   - "application/json"
    33  	//   - "application/xml"
    34  	// produces:
    35  	//   - "application/xml"
    36  	//   - "application/json"
    37  	// responses:
    38  	//   "200":
    39  	//     description: An paged array of pets
    40  	//     headers:
    41  	//       x-next:
    42  	//         type: string
    43  	//         description: A link to the next page of responses
    44  	//     schema:
    45  	//       type: array
    46  	//       items:
    47  	//         schema:
    48  	//           type: object
    49  	//           required:
    50  	//             - id
    51  	//             - name
    52  	//           properties:
    53  	//             id:
    54  	//               type: integer
    55  	//               format: int64
    56  	//             name:
    57  	//               type: string
    58  	//   default:
    59  	//     description: unexpected error
    60  	//     schema:
    61  	//       type: object
    62  	//       required:
    63  	//         - code
    64  	//         - message
    65  	//       properties:
    66  	//         code:
    67  	//           type: integer
    68  	//           format: int32
    69  	//         message:
    70  	//           type: string
    71  	// security:
    72  	//   -
    73  	//     petstore_auth:
    74  	//       - "write:pets"
    75  	//       - "read:pets"
    76  	mountItem("GET", basePath+"/pets", nil)
    77  
    78  	// swagger:operation PUT /pets/{id} pets updatePet
    79  	//
    80  	// Updates the details for a pet.
    81  	//
    82  	// Some long explanation,
    83  	// spanning over multipele lines,
    84  	// AKA the description.
    85  	//
    86  	// ---
    87  	// consumes:
    88  	//   - "application/json"
    89  	//   - "application/xml"
    90  	// produces:
    91  	//   - "application/xml"
    92  	//   - "application/json"
    93  	// parameters:
    94  	//   -
    95  	//     in: "body"
    96  	//     name: "body"
    97  	//     description: "Pet object that needs to be added to the store"
    98  	//     required: true
    99  	//     schema:
   100  	//       type: object
   101  	//       required:
   102  	//       - name
   103  	//       properties:
   104  	//         name:
   105  	//           type: string
   106  	//         age:
   107  	//           type: integer
   108  	//           format: int32
   109  	//           minimum: 0
   110  	//   -
   111  	//     in: "path"
   112  	//     name: "id"
   113  	//     description: "Pet object that needs to be added to the store"
   114  	//     required: true
   115  	//     schema:
   116  	//       type: string
   117  	//       pattern: "[A-Z]{3}-[0-9]{3}"
   118  	// responses:
   119  	//   400:
   120  	//     description: "Invalid ID supplied"
   121  	//   404:
   122  	//     description: "Pet not found"
   123  	//   405:
   124  	//     description: "Validation exception"
   125  	// security:
   126  	//   -
   127  	//     petstore_auth:
   128  	//       - "write:pets"
   129  	//       - "read:pets"
   130  	mountItem("PUT", basePath+"/pets/{id}", nil)
   131  
   132  	// swagger:operation GET /v1/events Events getEvents
   133  	//
   134  	// Events
   135  	//
   136  	// Mitigation Events
   137  	//
   138  	// ---
   139  	// consumes:
   140  	//   - "application/json"
   141  	//   - "application/xml"
   142  	// produces:
   143  	//   - "application/xml"
   144  	//   - "application/json"
   145  	// parameters:
   146  	// - name: running
   147  	//   in: query
   148  	//   description: (boolean) Filters
   149  	//   required: false
   150  	//   type: boolean
   151  	//
   152  	// responses:
   153  	//  '200':
   154  	//    description: '200'
   155  	//    schema:
   156  	//	    "$ref": "#/definitions/ListResponse"
   157  	//  '400':
   158  	//    description: '400'
   159  	//    schema:
   160  	//      "$ref": "#/definitions/ErrorResponse"
   161  	// security:
   162  	//   -
   163  	//     petstore_auth:
   164  	//       - "write:pets"
   165  	//       - "read:pets"
   166  	mountItem("GET", basePath+"/events", nil)
   167  
   168  	// no errors to return, all good
   169  	return
   170  }
   171  
   172  // not really used but I need a method to decorate the calls to
   173  func mountItem(method, path string, handler interface{}) {}