class Swagger::Schema

Attributes

current[RW]
lazy_schema[R]
schema[R]

Public Class Methods

load_file(filepath) click to toggle source
# File lib/swagger/schema.rb, line 19
def load_file(filepath)
  new(YAML.load_file(filepath)) # rubocop:disable Airbnb/UnsafeYamlMarshal
end
load_file_to_current(file_path) click to toggle source
# File lib/swagger/schema.rb, line 23
def load_file_to_current(file_path)
  @current = load_file(file_path)
end
new(schema) click to toggle source
# File lib/swagger/schema.rb, line 28
def initialize(schema)
  @schema = schema
end

Public Instance Methods

component(name) click to toggle source
# File lib/swagger/schema.rb, line 39
def component(name)
  # HogeSerializer
  name = name.name.sub(/Serializer$/, "") if name.class == Class
  component = Util.try_hash(components, name)
  Component.new(component) if component
end
path(path) click to toggle source
# File lib/swagger/schema.rb, line 34
def path(path)
  path_item = Util.try_hash(paths, path)
  PathItem.new(path_item) if path_item
end