Class: GrapeOAS::Exporter::OAS31::Schema

Inherits:
GrapeOAS::Exporter::OAS3::Schema show all
Defined in:
lib/grape_oas/exporter/oas31/schema.rb

Overview

OAS3.1-specific Schema exporter Differs from OAS3 by preferring ‘examples` over deprecated `example`.

Instance Method Summary collapse

Methods inherited from GrapeOAS::Exporter::OAS3::Schema

#apply_all_constraints, #apply_examples, #apply_extensions_and_extra_properties, #build_base_hash, #initialize

Constructor Details

This class inherits a constructor from GrapeOAS::Exporter::OAS3::Schema

Instance Method Details

#buildObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/grape_oas/exporter/oas31/schema.rb', line 13

def build
  hash = super

  # swap example -> examples if present
  if hash.key?("example")
    ex = hash.delete("example")
    hash["examples"] ||= ex
  end
  normalize_examples!(hash)
  hash
end

#openapi_versionObject



9
10
11
# File 'lib/grape_oas/exporter/oas31/schema.rb', line 9

def openapi_version
  "3.1.0"
end