Module: OpenAPI::Loader

Defined in:
lib/open_api/loader.rb,
lib/open_api/loader/ref.rb,
lib/open_api/loader/reader.rb,
lib/open_api/loader/collector.rb,
lib/open_api/loader/translator.rb,
lib/open_api/loader/denormalizer.rb

Overview

Loads OAS specification from a file and converts it to OAS3 format

See Also:

  • https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
  • https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md

Defined Under Namespace

Classes: Collector, Denormalizer, Reader, Ref, Translator

Class Method Summary collapse

Class Method Details

.call(filename, denormalize: true) ⇒ Hash

Loads the specification from given file

Parameters:

  • filename (String)

    The name of file containing a specification

  • [Boolean] (Hash)

    a customizable set of options

Returns:

  • (Hash)

    the specification



36
37
38
39
40
41
42
# File 'lib/open_api/loader.rb', line 36

def call(filename, denormalize: true)
  normalized = [Collector, Translator].inject(filename) do |output, item|
    item.call(output)
  end

  denormalize ? Denormalizer.call(normalized) : normalized
end