Class: OpenapiBlocks::Schema::Extractor
- Inherits:
-
Object
- Object
- OpenapiBlocks::Schema::Extractor
- Defined in:
- lib/openapi_blocks/schema/extractor.rb
Overview
rubocop:disable Style/Documentation
Constant Summary collapse
- IGNORED_COLUMNS =
%w[ password_digest encrypted_password reset_password_token reset_password_sent_at remember_created_at confirmation_token confirmed_at confirmation_sent_at unconfirmed_email failed_attempts unlock_token locked_at ].freeze
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(openapi_class) ⇒ Extractor
constructor
A new instance of Extractor.
Constructor Details
#initialize(openapi_class) ⇒ Extractor
Returns a new instance of Extractor.
23 24 25 26 27 |
# File 'lib/openapi_blocks/schema/extractor.rb', line 23 def initialize(openapi_class) @openapi_class = openapi_class @model = openapi_class.model @ignored = Array(openapi_class._ignored) + IGNORED_COLUMNS end |
Instance Method Details
#extract ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/openapi_blocks/schema/extractor.rb', line 29 def extract properties = {} column_properties.each { |name, schema| properties[name] = schema } virtual_properties.each { |name, schema| properties[name] = schema } association_properties.each { |name, schema| properties[name] = schema } { type: "object", required: required_columns, properties: properties }.compact end |