Module: ActiveAgent::SchemaGenerator
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_agent/schema_generator.rb
Overview
Provides automatic JSON Schema generation from ActiveRecord and ActiveModel classes.
This module can be included in any ActiveRecord or ActiveModel class to add the ability to generate JSON Schema representations. The generated schemas can be used for API documentation, validation, or as input to AI models that support structured outputs.
Defined Under Namespace
Modules: ActiveModelClassMethods, ActiveRecordClassMethods Classes: Builder
Instance Method Summary collapse
-
#generate_schema_view(model_class, options = {}) ⇒ String
deprecated
Deprecated.
This method may be removed in future versions. Use the class method ‘to_json_schema` instead.
Instance Method Details
#generate_schema_view(model_class, options = {}) ⇒ String
This method may be removed in future versions. Use the class method ‘to_json_schema` instead.
Generates a JSON string representation of a model’s schema.
This is an instance method that can be used to generate schema views for individual model instances, though it operates on the class level.
427 428 429 430 |
# File 'lib/active_agent/schema_generator.rb', line 427 def generate_schema_view(model_class, = {}) schema = ActiveAgent::SchemaGenerator::Builder.json_schema_from_model(model_class, ) schema.to_json end |