Class: Committee::Drivers::OpenAPI2::HeaderSchemaBuilder
- Inherits:
-
SchemaBuilder
- Object
- SchemaBuilder
- Committee::Drivers::OpenAPI2::HeaderSchemaBuilder
- Defined in:
- lib/committee/drivers/open_api_2/header_schema_builder.rb
Instance Method Summary collapse
Methods inherited from SchemaBuilder
Constructor Details
This class inherits a constructor from Committee::Drivers::OpenAPI2::SchemaBuilder
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/committee/drivers/open_api_2/header_schema_builder.rb', line 7 def call if link_data["parameters"] link_schema = JsonSchema::Schema.new link_schema.properties = {} link_schema.required = [] header_parameters = link_data["parameters"].select { |param_data| param_data["in"] == "header" } header_parameters.each do |param_data| check_required_fields!(param_data) param_schema = JsonSchema::Schema.new param_schema.type = [param_data["type"]] link_schema.properties[param_data["name"]] = param_schema if param_data["required"] == true link_schema.required << param_data["name"] end end link_schema end end |