Module: EasyTalk
- Defined in:
- lib/easy_talk.rb,
lib/easy_talk/model.rb,
lib/easy_talk/errors.rb,
lib/easy_talk/schema.rb,
lib/easy_talk/version.rb,
lib/easy_talk/keywords.rb,
lib/easy_talk/property.rb,
lib/easy_talk/ref_helper.rb,
lib/easy_talk/model_helper.rb,
lib/easy_talk/configuration.rb,
lib/easy_talk/errors_helper.rb,
lib/easy_talk/schema_methods.rb,
lib/easy_talk/types/composer.rb,
lib/easy_talk/error_formatter.rb,
lib/easy_talk/builders/registry.rb,
lib/easy_talk/naming_strategies.rb,
lib/easy_talk/schema_definition.rb,
lib/easy_talk/type_introspection.rb,
lib/easy_talk/validation_builder.rb,
lib/easy_talk/types/base_composer.rb,
lib/easy_talk/error_formatter/base.rb,
lib/easy_talk/error_formatter/flat.rb,
lib/easy_talk/builders/base_builder.rb,
lib/easy_talk/builders/null_builder.rb,
lib/easy_talk/builders/union_builder.rb,
lib/easy_talk/tools/function_builder.rb,
lib/easy_talk/builders/number_builder.rb,
lib/easy_talk/builders/object_builder.rb,
lib/easy_talk/builders/string_builder.rb,
lib/easy_talk/error_formatter/jsonapi.rb,
lib/easy_talk/error_formatter/rfc7807.rb,
lib/easy_talk/builders/boolean_builder.rb,
lib/easy_talk/builders/integer_builder.rb,
lib/easy_talk/validation_adapters/base.rb,
lib/easy_talk/builders/temporal_builder.rb,
lib/easy_talk/builders/collection_helpers.rb,
lib/easy_talk/builders/composition_builder.rb,
lib/easy_talk/builders/typed_array_builder.rb,
lib/easy_talk/error_formatter/json_pointer.rb,
lib/easy_talk/validation_adapters/registry.rb,
lib/easy_talk/error_formatter/path_converter.rb,
lib/easy_talk/validation_adapters/none_adapter.rb,
lib/easy_talk/error_formatter/error_code_mapper.rb,
lib/easy_talk/validation_adapters/active_model_adapter.rb
Overview
typed: true
Defined Under Namespace
Modules: Builders, ErrorFormatter, ErrorHelper, Model, ModelHelper, NamingStrategies, RefHelper, Schema, SchemaMethods, Tools, TypeIntrospection, Types, ValidationAdapters Classes: Configuration, ConstraintError, Error, InvalidInstructionsError, InvalidPropertyNameError, Property, SchemaDefinition, UnknownOptionError, UnknownTypeError, ValidationBuilder
Constant Summary collapse
- VERSION =
'3.2.0'- KEYWORDS =
%i[ schema_id schema_version description type title property required items additional_items pattern_properties additional_properties dependencies dependent_required format content_media_type content_encoding enum const default examples max_length min_length pattern maximum exclusive_maximum minimum exclusive_minimum multiple_of max_items min_items unique_items max_properties min_properties ].freeze
Class Method Summary collapse
- .assert_valid_property_options(property_name, options, *valid_keys) ⇒ Object
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .configure_nilable_behavior(nilable_is_optional = false) ⇒ Object
-
.register_type(type_key, builder_class, collection: false)
Register a custom type with its corresponding schema builder.
Class Method Details
.assert_valid_property_options(property_name, options, *valid_keys) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/easy_talk.rb', line 58 def self.(property_name, , *valid_keys) valid_keys.flatten! .each_key do |k| next if valid_keys.include?(k) ErrorHelper.raise_unknown_option_error(property_name: property_name, option: , valid_options: valid_keys) end end |
.configuration ⇒ Object
65 66 67 |
# File 'lib/easy_talk/configuration.rb', line 65 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
69 70 71 |
# File 'lib/easy_talk/configuration.rb', line 69 def configure yield(configuration) end |
.configure_nilable_behavior(nilable_is_optional = false) ⇒ Object
67 68 69 |
# File 'lib/easy_talk.rb', line 67 def self.configure_nilable_behavior(nilable_is_optional = false) configuration.nilable_is_optional = nilable_is_optional end |
.register_type(type_key, builder_class, collection: false)
This method returns an undefined value.
Register a custom type with its corresponding schema builder.
This allows extending EasyTalk with domain-specific types without modifying the gem's source code.
54 55 56 |
# File 'lib/easy_talk.rb', line 54 def self.register_type(type_key, builder_class, collection: false) Builders::Registry.register(type_key, builder_class, collection: collection) end |