Module: EasyTalk
- Extended by:
- T::Sig
- 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/types/tuple.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/json_schema_equality.rb,
lib/easy_talk/builders/base_builder.rb,
lib/easy_talk/builders/null_builder.rb,
lib/easy_talk/builders/tuple_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,
lib/easy_talk/validation_adapters/active_model_schema_validation.rb
Overview
typed: true
Defined Under Namespace
Modules: Builders, ErrorFormatter, ErrorHelper, JsonSchemaEquality, 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.3.0'- KEYWORDS =
i[ schema_id schema_version description type title 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
59 60 61 62 63 64 65 66 |
# File 'lib/easy_talk.rb', line 59 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
79 80 81 |
# File 'lib/easy_talk/configuration.rb', line 79 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
84 85 86 |
# File 'lib/easy_talk/configuration.rb', line 84 def configure(&block) yield(configuration) end |
.configure_nilable_behavior(nilable_is_optional = false) ⇒ Object
68 69 70 |
# File 'lib/easy_talk.rb', line 68 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.
55 56 57 |
# File 'lib/easy_talk.rb', line 55 def self.register_type(type_key, builder_class, collection: false) Builders::Registry.register(type_key, builder_class, collection: collection) end |