Sha256: 14a10e105a6174631578096b9b13754ea9c129d94db97028bb80e5943146acf6
Contents?: true
Size: 650 Bytes
Versions: 13
Compression:
Stored size: 650 Bytes
Contents
module SwaggerYard class Type def self.from_type_list(types) new(types.first) end attr_reader :name, :source, :schema def initialize(string) @source = string @schema = TypeParser.new.json_schema(string) @name = name_for(@schema) @name = name_for(@schema['items']) if @name == 'array' end # TODO: have this look at resource listing? def ref? schema["$ref"] end def model_name ref? ? name : nil end def to_h schema end private def name_for(schema) schema["type"] || schema["$ref"][%r'#/definitions/(.*)', 1] end end end
Version data entries
13 entries across 13 versions & 1 rubygems