Sha256: 16bc0776f357e5b4e67bcbb9f1432a2520d172c3f6ae640a97e177afdea40764
Contents?: true
Size: 798 Bytes
Versions: 1
Compression:
Stored size: 798 Bytes
Contents
# frozen_string_literal: true require_relative "oapi/version" require "zeitwerk" loader = Zeitwerk::Loader.for_gem loader.inflector.inflect( "oapi" => "OAPI", "open_api" => "OpenAPI", "json" => "JSON" ) loader.setup module OAPI class Error < StandardError # Your code goes here... end class UnsupportedSpecVersion < Error end class << self def define(&) # TODO: check version # raise UnsupportedSpecVersion, "unsupported version #{version}" unless version.start_with?("3.0") OAPI::OpenAPI::V30::Definition.new(&) end 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oapi-0.1.3 | lib/oapi.rb |