...

Text file src/github.com/go-openapi/analysis/fixtures/widget-crud.yml

Documentation: github.com/go-openapi/analysis/fixtures

     1---
     2swagger: '2.0'
     3info:
     4  title: widget CRUD API
     5  version: 4.2.0
     6schemes:
     7  - http
     8basePath: /api
     9consumes:
    10  - application/json
    11produces:
    12  - application/json
    13securityDefinitions:
    14  myRoles:
    15    description: definition of scopes as roles
    16    type: oauth2
    17    flow: accessCode 
    18    authorizationUrl: https://foo.bar.com/authorize
    19    tokenUrl: https://foo.bar.com/token
    20    scopes:
    21      sellers: group of sellers
    22      buyers: group of buyers
    23  myPrimaryAPIKey:
    24    type: apiKey
    25    name: X-primaryApiKey
    26    in: header
    27  myBasicAuth:
    28    type: basic
    29    description: basic primary auth
    30security:
    31  - myPrimaryAPIKey: []
    32  - 
    33    myBasicAuth: []
    34    myRoles: [ sellers ]
    35  - 
    36    myBasicAuth: []
    37tags:
    38  - name: conflict
    39    description: a tag in conflict with primary spec
    40paths:
    41  /common:
    42    get:
    43      operationId: commonGet
    44      summary: here to test path collisons
    45      responses:
    46        '200':
    47          description: OK
    48          schema:
    49            $ref: "#/definitions/widget"
    50
    51  /widgets:
    52    post:
    53      operationId: create
    54      summary: Create a new widget
    55      parameters:
    56        - name: info
    57          in: body
    58          schema:
    59            $ref: "#/definitions/widget"
    60      responses:
    61        '201':
    62          description: created
    63          schema:
    64            $ref: "#/definitions/widgetId"
    65        default:
    66          description: error
    67          schema:
    68            $ref: "#/definitions/error"
    69  /widgets/{widgetid}:
    70    get:
    71      operationId: get
    72      summary: Get a widget by id
    73      parameters:
    74        - $ref: "#/parameters/widgetid"
    75      responses:
    76        '200':
    77          description: OK
    78          schema:
    79            $ref: "#/definitions/widget"
    80        '401':
    81          $ref: "#/responses/401"
    82        '404':
    83          $ref: "#/responses/404"
    84        default:
    85          description: error
    86          schema:
    87            $ref: "#/definitions/error"
    88    delete:
    89      operationId: delete
    90      summary: delete a widget by id
    91      parameters:
    92        - name: widgetid
    93          in: path
    94          required: true
    95          type: string
    96      responses:
    97        '200':
    98          description: OK
    99        '401':
   100          description: unauthorized
   101          schema:
   102            $ref: "#/definitions/error"
   103        '404':
   104          description: resource not found
   105          schema:
   106            $ref: "#/definitions/error"
   107        default:
   108          description: error
   109          schema:
   110            $ref: "#/definitions/error"
   111    post:
   112      operationId: update
   113      summary: update a widget by id
   114      parameters:
   115        - name: widgetid
   116          in: path
   117          required: true
   118          type: string
   119        - name: info
   120          in: body
   121          schema:
   122            $ref: "#/definitions/widget"
   123      responses:
   124        '200':
   125          description: OK
   126        '401':
   127          description: unauthorized
   128          schema:
   129            $ref: "#/definitions/error"
   130        '404':
   131          description: resource not found
   132          schema:
   133            $ref: "#/definitions/error"
   134        default:
   135          description: error
   136          schema:
   137            $ref: "#/definitions/error"
   138
   139definitions:
   140  common:
   141    type: object
   142    required:
   143      - id
   144    properties:
   145      id:
   146        type: string
   147        format: string
   148        minLength: 1
   149  widget:
   150    type: object
   151    required:
   152      - name
   153      - description
   154    properties:
   155      id:
   156        type: string
   157        format: string
   158        readOnly: true
   159      name:
   160        type: string
   161        format: string
   162        minLength: 1
   163      description:
   164        type: string
   165        format: string
   166        minLength: 1
   167  widgetId:
   168    type: object
   169    required:
   170      - id
   171    properties:
   172      id:
   173        type: string
   174        format: string
   175        minLength: 1
   176  error:
   177    type: object
   178    required:
   179       - message
   180    properties:
   181      code:
   182        type: string
   183        format: string
   184      message:
   185        type: string
   186      fields:
   187        type: string
   188
   189parameters:
   190  common:
   191    name: common
   192    in: query
   193    type: string
   194  widgetid:
   195    name: widgetid
   196    in: path
   197    required: true
   198    type: string
   199
   200responses:
   201  401:
   202    description: widget unauthorized
   203    schema:
   204      $ref: "#/definitions/error"
   205  404:
   206    description: widget resource not found
   207    schema:
   208      $ref: "#/definitions/error"

View as plain text