Module: Serega::SeregaPlugins::OpenAPI::ClassMethods
- Defined in:
- lib/serega/plugins/openapi/openapi.rb
Overview
Serega additional/patched class methods
Instance Method Summary collapse
-
#openapi_properties(props = FROZEN_EMPTY_HASH) ⇒ Hash
Adds new OpenAPI properties and returns all properties.
-
#openapi_schema ⇒ Object
OpenAPI schema for current serializer.
-
#openapi_schema_name ⇒ String
Builds OpenAPI schema name using configured builder.
Instance Method Details
#openapi_properties(props = FROZEN_EMPTY_HASH) ⇒ Hash
Adds new OpenAPI properties and returns all properties
202 203 204 |
# File 'lib/serega/plugins/openapi/openapi.rb', line 202 def openapi_properties(props = FROZEN_EMPTY_HASH) config.openapi.properties(props) end |
#openapi_schema ⇒ Object
OpenAPI schema for current serializer
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/serega/plugins/openapi/openapi.rb', line 178 def openapi_schema properties = SeregaUtils::EnumDeepDup.call(openapi_properties) required_properties = [] attributes.each do |attribute_name, attribute| add_openapi_property(properties, attribute_name, attribute) add_openapi_required_property(required_properties, attribute_name, attribute) end { type: "object", properties: properties, required: required_properties, additionalProperties: false } end |
#openapi_schema_name ⇒ String
Builds OpenAPI schema name using configured builder
211 212 213 |
# File 'lib/serega/plugins/openapi/openapi.rb', line 211 def openapi_schema_name config.openapi.schema_name_builder.call(self) end |