Sha256: b361fccbb6dd7bdee3797cb1ea4001227550119fd713f5feaa95398e47b447f3

Contents?: true

Size: 809 Bytes

Versions: 8

Compression:

Stored size: 809 Bytes

Contents

module OasParser
  class Parameter < AbstractAttribute
    raw_keys :in, :description, :style, :schema,
             :minimum, :maximum, :required

    attr_accessor :owner, :raw

    def initialize(owner, raw)
      @owner = owner
      @raw = raw
    end

    def type
      raw['type'] || (schema ? schema['type'] : nil)
    end

    def format
      raw['format'] || (schema ? schema['format'] : nil)
    end

    def items
      schema['items']
    end

    def example
      raw['example'] || (schema ? schema['example'] : nil)
    end

    def default
      raw['default'] || (schema ? schema['default'] : nil)
    end

    def convert_property_schema_to_properties(schema)
      schema.map do |name, definition|
        OasParser::Property.new(self, raw, name, definition)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
oas_parser-0.14.0 lib/oas_parser/parameter.rb
oas_parser-0.13.1 lib/oas_parser/parameter.rb
oas_parser-0.12.0 lib/oas_parser/parameter.rb
oas_parser-0.11.2 lib/oas_parser/parameter.rb
oas_parser-0.11.1 lib/oas_parser/parameter.rb
oas_parser-0.11.0 lib/oas_parser/parameter.rb
oas_parser-0.10.0 lib/oas_parser/parameter.rb
oas_parser-0.9.0 lib/oas_parser/parameter.rb