Class: MobileWorkflow::OpenApiSpec::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/mobile_workflow/open_api_spec/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(open_api_spec_string) ⇒ Parser

Returns a new instance of Parser.



6
7
8
# File 'lib/mobile_workflow/open_api_spec/parser.rb', line 6

def initialize(open_api_spec_string)
  @open_api_spec_string = open_api_spec_string
end

Instance Method Details

#controller_name_to_actionsObject



23
24
25
# File 'lib/mobile_workflow/open_api_spec/parser.rb', line 23

def controller_name_to_actions
  @controller_name_to_actions ||= parse_controller_names_to_actions
end

#model_name_to_propertiesObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mobile_workflow/open_api_spec/parser.rb', line 10

def model_name_to_properties
  @model_properties = {}
  schemas.each_pair do |model_name, schema|
    next if model_name.start_with?('MW')

    model_name = model_name.underscore
    model_properties = schema_model_properties(model_name, schema)

    @model_properties[model_name] = model_properties
  end
  @model_properties
end

#pathsObject



27
28
29
# File 'lib/mobile_workflow/open_api_spec/parser.rb', line 27

def paths
  @paths ||= open_api_spec[:paths].keys
end

#schemasObject



31
32
33
# File 'lib/mobile_workflow/open_api_spec/parser.rb', line 31

def schemas
  @schemas ||= open_api_spec[:components][:schemas]
end