- Support "AdditionalProperties". see https://json-schema.org/understanding-json-schema/reference/object#additionalproperties You can now define a schema that allows any additional properties.
class Company
include EasyTalk::Model
define_schema do
property :name, String
additional_properties true # or false
end
end
You can then do:
company = Company.new
company.name = "Acme Corp" # Defined property
company.location = "New York" # Additional property
company.employee_count = 100 # Additional property
company.as_json
- Fix that we don't conflate nilable properties with optional properties.
## [1.0.1] - 2024-09-01
- Fixed that property with custom type does not ignore the constraints hash https://github.com/sergiobayona/easy_talk/issues/17
## [1.0.0] - 2024-06-01
- Use `Hash` instead of `:object` for inline object schema definition.
example:
```ruby
property :email, Hash do
property :address, :string
property :verified, :boolean
end
- Loosen up the gemspec version requirement. Makes it flexible to use the library with future versions of Rails (i.e 8.*).
- Removed JSONScheemer gem dependency.
- The library does not validate by default anymore. Validating an instance requires that you explicitly define ActiveModel validations in your EasyTalk model. See: https://github.com/sergiobayona/easy_talk/blob/main/spec/easy_talk/activemodel_integration_spec.rb.
- Internal improvements to
EasyTalk::ObjectBuilder
class. No changes to the public API. - Expanded the test suite.
- Fixed a bug where optional properties were not excluded from the required list.
- Run JSON Schema validations using ActiveModel's validations.
- Added ActiveModel::API functionality to EasyTalk::Model module. That means you get all the benefits of ActiveModel::API including attribute assignment, introspections, validations, translation (i18n) and more. See https://api.rubyonrails.org/classes/ActiveModel/API.html for more information.
- Accept
:optional
key as constraint which excludes property from required node. - Spec fixes
- Added the ability to describe an object schema withing the define_schema block. Example:
...
property :email, :object do
property :address, :string
property :verified, :boolean
end
- mostly refactoring without changes to the public API.
- general cleanup and refactoring.
- model instance takes a hash and converts it to attribute methods.
- Added helper method for generating an openai function.
- Bumped activesupport gem version.
- Bumped json-schema gem version.
- Added json validation.
- Removed pry-byebug.
- Initial release