Module: OAPI

Defined in:
lib/oapi.rb,
lib/oapi/version.rb

Defined Under Namespace

Modules: Monkey, Properties Classes: Error, Ref, Schema, UnsupportedSpecVersion

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.defineObject



26
27
28
29
30
31
# File 'lib/oapi.rb', line 26

def define(&)
  # TODO: check version
  # raise UnsupportedSpecVersion, "unsupported version #{version}" unless version.start_with?("3.0")

  OAPI::OpenAPI::V30::Definition.new(&)
end

.parse(json) ⇒ Object



33
34
35
36
37
38
# File 'lib/oapi.rb', line 33

def parse(json)
  version = json[:openapi]
  raise UnsupportedSpecVersion, "unsupported version #{version}" unless version.start_with?("3.0")

  OAPI::OpenAPI::V30::Parsers::JSON.parse(json)
end