def parse(data)
      REQUIRED_FIELDS.each do |field|
        if !data[field]
          raise ArgumentError, "Committee: no #{field} section in spec data."
        end
      end

      if data['swagger'] != '2.0'
        raise ArgumentError, "Committee: driver requires OpenAPI 2.0."
      end

      schema = Schema.new
      schema.driver = self

      schema.base_path = data['basePath'] || ''

      # Arbitrarily choose the first media type found in these arrays. This
      # appraoch could probably stand to be improved, but at least users will
      # for now have the option of turning media type validation off if they so
      # choose.
      schema.consumes = data['consumes'].first
      schema.produces = data['produces'].first

      schema.definitions, store = parse_definitions!(data)
      schema.routes = parse_routes!(data, schema, store)

      schema
    end
def parse(data)
      REQUIRED_FIELDS.each do |field|
        if !data[field]
          raise ArgumentError, "Committee: no #{field} section in spec data."
        end
      end

      if data['swagger'] != '2.0'
        raise ArgumentError, "Committee: driver requires OpenAPI 2.0."
      end

      schema = Schema.new
      schema.driver = self

      schema.base_path = data['basePath'] || ''

      # Arbitrarily choose the first media type found in these arrays. This
      # appraoch could probably stand to be improved, but at least users will
      # for now have the option of turning media type validation off if they so
      # choose.
      schema.consumes = data['consumes'].first
      schema.produces = data['produces'].first

      schema.definitions, store = parse_definitions!(data)
      schema.routes = parse_routes!(data, schema, store)

      schema
    end
Parses an API schema and builds a set of route definitions for use with
 Committee.

 The expected input format is a data hash with keys as strings (as opposed
 to symbols) like the kind produced by JSON.parse or YAML.load.