Module: DryValidationOpenapi::Convertable
- Defined in:
- lib/dry_validation_openapi/convertable.rb
Overview
Module to extend dry-validation contracts with OpenAPI schema generation
Instance Method Summary collapse
-
#clear_schema_cache! ⇒ nil
Clears the cached schema, forcing regeneration on next access Useful during development or when contract definition changes.
-
#location ⇒ String
Returns the file path where this contract class is defined.
-
#open_api_schema ⇒ Hash
Generates an OpenAPI schema from this contract’s params block.
Instance Method Details
#clear_schema_cache! ⇒ nil
Clears the cached schema, forcing regeneration on next access Useful during development or when contract definition changes
36 37 38 39 |
# File 'lib/dry_validation_openapi/convertable.rb', line 36 def clear_schema_cache! @open_api_schema = nil @location = nil end |
#location ⇒ String
Returns the file path where this contract class is defined
21 22 23 |
# File 'lib/dry_validation_openapi/convertable.rb', line 21 def location @location ||= Object.const_source_location(name)[0] end |
#open_api_schema ⇒ Hash
Generates an OpenAPI schema from this contract’s params block
28 29 30 |
# File 'lib/dry_validation_openapi/convertable.rb', line 28 def open_api_schema @open_api_schema ||= SchemaBuilder.build(location) end |