title: How do I refactor this Swagger API Spec
body: <p>I have a few endpoints where I have some standard error responses like <code>404</code>, <code>401</code>, <code>403</code> and <code>default</code>. I want to refactor these responses to a Swagger definition but I am not able to achieve this. I tried a few tricks but it always resulted in parsing errors. Here is the yaml I have.</p>
  
  <pre><code>swagger: '2.0'
  info:
    title: My API
    description: My API description
    version: 0.0.1
  host: api.example.com
  schemes:
    - https
  basePath: /
  produces:
    - application/json
  paths:
    /users:
      get:
        operationId: getUsers
        summary: Get users
        description: Get all users
        tags:
          - Users
        responses:
          '200':
            description: An array of users
            schema:
              type: array
              items:
                $ref: '#/definitions/User'
          '401':
            description: Authentication required
            schema:
              $ref: '#/definitions/Error'
          '402':
            description: Payment required
            schema:
              $ref: '#/definitions/Error'
          '403':
            description: Unauthorized access
            schema:
              $ref: '#/definitions/Error'
          '404':
            description: Not found
            schema:
              $ref: '#/definitions/Error'
          default:
            description: Unexpected error
            schema:
              $ref: '#/definitions/Error'
    /games:
      get:
        operationId: getGames
        summary: Get games
        description: Get all games
        tags:
          - Games
        responses:
          '200':
            description: An array of games
            schema:
              type: array
              items:
                $ref: '#/definitions/Game'
          '401':
            description: Authentication required
            schema:
              $ref: '#/definitions/Error'
          '402':
            description: Payment required
            schema:
              $ref: '#/definitions/Error'
          '403':
            description: Unauthorized access
            schema:
              $ref: '#/definitions/Error'
          '404':
            description: Not found
            schema:
              $ref: '#/definitions/Error'
          default:
            description: Unexpected error
            schema:
              $ref: '#/definitions/Error'
  definitions:
    User:
      type: object
      properties:
        id:
          type: integer
          description: Unique id of user
        name:
          type: string
          description: Name of user
    Game:
      type: object
      properties:
        id:
          type: integer
          description: Unique id of game
        name:
          type: string
          description: Name of game
    Error:
      type: object
      properties:
        code:
          type: integer
          description: HTTP status code
        message:
          type: string
          description: Message describing error
  </code></pre>
  
  <p>Observe the repeating responses in <code>/users</code> and <code>/games</code>. How do I refactor and move them to <code>definitions</code>?</p>