swagger: '2.0'

################################################################################
#                              API Information                                 #
################################################################################
info:
  version: '1.0.0'
  title: Test both cascading $refs and basePath
  description: |
    This definition use both cascading $refs and a "non empty" basePath

################################################################################
#                  Host, Base Path, Schemes and Content Types                  #
################################################################################
# The host (name or ip) serving the API
host: localhost:5000

# The base path on which the API is served, relative to the host. Will be prefixed to all paths. Used to control versioning
basePath: /api/

# The transfer protocol of the API
schemes:
  - http
# Format of bodies a client can send (Content-Type)
consumes:
  - application/json
# Format of the responses to the client (Accepts)
produces:
  - application/json

################################################################################
#                                    Paths                                     #
################################################################################
paths:
  /get_cost:
    post:
      summary: a test with cascading $refs
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: request
          description: request
          required: true
          schema:
            $ref: '#/definitions/GetCostRequest'
      responses:
        '200':
          description: OK
          schema:
            type: array
            items:
              $ref: '#/definitions/GetCostResponse'
        '201':
          description: Created
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
      deprecated: false
definitions:
  GetCostResponse:
    type: object
    properties:
      description:
        type:
          string
      cost:
        $ref: '#/definitions/Cost'
    title: GetCost response
  GetCostRequest:
    type: object
    properties:
      level:
        type: integer
      location:
        $ref: '#/definitions/Location'
    title: GetCost Request
  Cost:
    type: object
    properties:
      currency:
        type: string
        description: cost currency (3-letters code)
      value:
        type: number
        description: cost value
    title: Cost
  GeoPosition:
    type: object
    properties:
      latitude:
        type: number
        format: double
        description: latitude in float
      longitude:
        type: number
        format: double
        description: longitude in float
    title: GeoPosition
  Location:
    type: object
    properties:
      name:
        type: string
        description: name of the location
      position:
        description: position of the location
        $ref: '#/definitions/GeoPosition'
    title: Location
