Class: Apiwork::Export::OpenAPI

Inherits:
Base
  • Object
show all
Defined in:
lib/apiwork/export/open_api.rb

Constant Summary collapse

KEY_ORDER =
%i[openapi info servers paths components].freeze

Instance Attribute Summary

Attributes inherited from Base

#api, #api_base_path, #options

Instance Method Summary collapse

Methods inherited from Base

content_type_for, export_name, extract_nested_option, extract_nested_option_from_env, extract_options, #extract_options_from_config, extract_options_from_env, file_extension, file_extension_for, generate, hash_output?, #initialize, #key_format, output, #serialize, string_output?, supports_format?, #transform_key, #validate_options!

Methods included from Configurable

define, option

Constructor Details

This class inherits a constructor from Apiwork::Export::Base

Instance Method Details

#generateObject



13
14
15
16
17
18
19
20
21
# File 'lib/apiwork/export/open_api.rb', line 13

def generate
  {
    components: { schemas: build_schemas },
    info: build_info,
    openapi: options[:version],
    paths: build_paths,
    servers: build_servers,
  }.slice(*KEY_ORDER).compact
end