class Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::FieldDefinitions::EndpointParamFormatter
Public Class Methods
new(endpoint, param_name, param_tree)
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/field_definitions/endpoint_param_formatter.rb, line 10 def initialize(endpoint, param_name, param_tree) @endpoint = endpoint @param_name = param_name @param_tree = param_tree end
Public Instance Methods
format_object_field(field_config, field_properties, include_description = true)
click to toggle source
Calls superclass method
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/field_definitions/endpoint_param_formatter.rb, line 16 def format_object_field(field_config, field_properties, include_description = true) super(field_config, field_properties, include_description).tap do |field_schema| if (required_props = required_properties(field_properties)).present? field_schema[:required] = required_props end end end
required_properties(field_properties)
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/field_definitions/endpoint_param_formatter.rb, line 24 def required_properties(field_properties) field_properties.select do |_, property_data| !property_data[:_config][:dynamic_key] && property_data[:_config][:required] end.keys end