Class: Fictium::OpenApi::V3Exporter
- Inherits:
-
Object
- Object
- Fictium::OpenApi::V3Exporter
- Defined in:
- lib/fictium/exporters/open_api/v3_exporter.rb,
lib/fictium/exporters/open_api/v3_exporter/path_formatter.rb,
lib/fictium/exporters/open_api/v3_exporter/path_generator.rb,
lib/fictium/exporters/open_api/v3_exporter/param_formatter.rb,
lib/fictium/exporters/open_api/v3_exporter/content_formatter.rb,
lib/fictium/exporters/open_api/v3_exporter/example_formatter.rb
Defined Under Namespace
Classes: ContentFormatter, ExampleFormatter, ParamFormatter, PathFormatter, PathGenerator
Constant Summary collapse
- DEFAULT_PROPERTIES =
{ openapi: '3.0.0' }.freeze
- FIXTURE_TYPES =
%w[servers security tags].freeze
- INFO_OPTIONS =
%w[title description terms_of_service contract license version].freeze
Instance Method Summary collapse
Instance Method Details
#export(document) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/fictium/exporters/open_api/v3_exporter.rb', line 17 def export(document) result = DEFAULT_PROPERTIES .merge(create_fixtures) .merge(info: create_info, paths: create_paths(document)) validate!(result) FileUtils.mkdir_p(File.dirname(export_file)) File.write(export_file, pretty_print? ? JSON.pretty_generate(result) : result.to_json) end |