Sha256: 8eb95faa097949d24a2f8f49ca652ac44867acdab92a27132a071e5105037025

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

module OasParser
  class Parameter < AbstractAttribute
    raw_keys :name, :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

1 entries across 1 versions & 1 rubygems

Version Path
oas_parser-0.8.1 lib/oas_parser/parameter.rb