Module: Lutaml::Model::Schema
- Defined in:
- lib/lutaml/model/schema.rb,
lib/lutaml/model/schema/helpers.rb,
lib/lutaml/model/schema/renderer.rb,
lib/lutaml/model/schema/generator.rb,
lib/lutaml/model/schema/renderers.rb,
lib/lutaml/model/schema/templates.rb,
lib/lutaml/model/schema/decorators.rb,
lib/lutaml/model/schema/base_schema.rb,
lib/lutaml/model/schema/definitions.rb,
lib/lutaml/model/schema/file_writer.rb,
lib/lutaml/model/schema/json_schema.rb,
lib/lutaml/model/schema/yaml_schema.rb,
lib/lutaml/model/schema/class_loader.rb,
lib/lutaml/model/schema/rnc_compiler.rb,
lib/lutaml/model/schema/rng_compiler.rb,
lib/lutaml/model/schema/xml_compiler.rb,
lib/lutaml/model/schema/generator/ref.rb,
lib/lutaml/model/schema/module_nesting.rb,
lib/lutaml/model/schema/renderers/base.rb,
lib/lutaml/model/schema/shared_methods.rb,
lib/lutaml/model/schema/compiled_output.rb,
lib/lutaml/model/schema/renderers/model.rb,
lib/lutaml/model/schema/renderers/union.rb,
lib/lutaml/model/schema/namespace_naming.rb,
lib/lutaml/model/schema/definitions/facet.rb,
lib/lutaml/model/schema/definitions/model.rb,
lib/lutaml/model/schema/decorators/choices.rb,
lib/lutaml/model/schema/definitions/choice.rb,
lib/lutaml/model/schema/generator/property.rb,
lib/lutaml/model/schema/json_schema_parser.rb,
lib/lutaml/model/schema/registry_generator.rb,
lib/lutaml/model/schema/renderers/mappings.rb,
lib/lutaml/model/schema/schema_builder/oga.rb,
lib/lutaml/model/schema/renderers/namespace.rb,
lib/lutaml/model/schema/decorators/attribute.rb,
lib/lutaml/model/schema/definitions/sequence.rb,
lib/lutaml/model/schema/definitions/type_ref.rb,
lib/lutaml/model/schema/definitions/xml_root.rb,
lib/lutaml/model/schema/generator/definition.rb,
lib/lutaml/model/schema/definitions/attribute.rb,
lib/lutaml/model/schema/definitions/namespace.rb,
lib/lutaml/model/schema/definitions/union_type.rb,
lib/lutaml/model/schema/renderers/member_decls.rb,
lib/lutaml/model/schema/renderers/registration.rb,
lib/lutaml/model/schema/definitions/member_walk.rb,
lib/lutaml/model/schema/helpers/template_helper.rb,
lib/lutaml/model/schema/schema_builder/nokogiri.rb,
lib/lutaml/model/schema/definitions/group_import.rb,
lib/lutaml/model/schema/rng_compiler/rng_helpers.rb,
lib/lutaml/model/schema/renderers/restricted_type.rb,
lib/lutaml/model/schema/xml_compiler/spec_builder.rb,
lib/lutaml/model/schema/definitions/simple_content.rb,
lib/lutaml/model/schema/xml_compiler/element_order.rb,
lib/lutaml/model/schema/decorators/class_definition.rb,
lib/lutaml/model/schema/definitions/restricted_type.rb,
lib/lutaml/model/schema/definitions/transform_facet.rb,
lib/lutaml/model/schema/rnc_compiler/source_resolver.rb,
lib/lutaml/model/schema/rng_compiler/element_visitor.rb,
lib/lutaml/model/schema/rng_compiler/member_collector.rb,
lib/lutaml/model/schema/rng_compiler/define_classifier.rb,
lib/lutaml/model/schema/generator/properties_collection.rb,
lib/lutaml/model/schema/xml_compiler/registry_generator.rb,
lib/lutaml/model/schema/decorators/definition_collection.rb,
lib/lutaml/model/schema/generator/definitions_collection.rb,
lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb,
lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb,
lib/lutaml/model/schema/xml_compiler/supported_data_types.rb,
lib/lutaml/model/schema/renderers/required_files_calculator.rb,
lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb,
lib/lutaml/model/schema/xml_compiler/spec_builder/complex_types.rb
Defined Under Namespace
Modules: Decorators, Definitions, Generator, Helpers, ModuleNesting, NamespaceNaming, Renderers, RncCompiler, RngCompiler, SharedMethods, Templates, XmlCompiler Classes: BaseSchema, ClassLoader, CompiledOutput, FileWriter, JsonSchemaParser, RegistryGenerator, Renderer, SchemaBuilder
Constant Summary collapse
- JsonSchema =
For backwards compatibility, delegate to the new location
::Lutaml::Json::Schema::JsonSchema
- YamlSchema =
For backwards compatibility, delegate to the new location
::Lutaml::Yaml::Schema::YamlSchema
Class Method Summary collapse
- .from_relaxng(_rng, _options = {}) ⇒ Object
- .from_rnc(_rnc, _options = {}) ⇒ Object
- .from_xml(_xml, _options = {}) ⇒ Object
-
.method_registered?(name) ⇒ Boolean
Check if a schema method is registered.
-
.register_method(name, &block) ⇒ Object
Register a schema method dynamically.
- .to_json(klass, options = {}) ⇒ Object
- .to_relaxng(_klass, _options = {}) ⇒ Object
-
.to_xsd(_klass, _options = {}) ⇒ Object
XML-specific methods (to_xsd, to_relaxng, from_xml) are registered by Lutaml::Xml at load time via register_method.
- .to_yaml(klass, options = {}) ⇒ Object
Class Method Details
.from_relaxng(_rng, _options = {}) ⇒ Object
77 78 79 |
# File 'lib/lutaml/model/schema.rb', line 77 def self.from_relaxng(_rng, = {}) raise "RELAX NG schema compilation requires lutaml-xml. Add it to your Gemfile." end |
.from_rnc(_rnc, _options = {}) ⇒ Object
81 82 83 |
# File 'lib/lutaml/model/schema.rb', line 81 def self.from_rnc(_rnc, = {}) raise "RNC schema compilation requires lutaml-xml. Add it to your Gemfile." end |
.from_xml(_xml, _options = {}) ⇒ Object
73 74 75 |
# File 'lib/lutaml/model/schema.rb', line 73 def self.from_xml(_xml, = {}) raise "XML schema compilation requires lutaml-xml. Add it to your Gemfile." end |
.method_registered?(name) ⇒ Boolean
Check if a schema method is registered.
50 51 52 |
# File 'lib/lutaml/model/schema.rb', line 50 def self.method_registered?(name) @registered_methods.key?(name) end |
.register_method(name, &block) ⇒ Object
Register a schema method dynamically. Format plugins call this to add their schema generation/parsing methods.
41 42 43 44 |
# File 'lib/lutaml/model/schema.rb', line 41 def self.register_method(name, &block) @registered_methods[name] = block define_singleton_method(name, &block) end |
.to_json(klass, options = {}) ⇒ Object
54 55 56 |
# File 'lib/lutaml/model/schema.rb', line 54 def self.to_json(klass, = {}) JsonSchema.generate(klass, ) end |
.to_relaxng(_klass, _options = {}) ⇒ Object
69 70 71 |
# File 'lib/lutaml/model/schema.rb', line 69 def self.to_relaxng(_klass, = {}) raise "RELAX NG schema generation requires lutaml-xml. Add it to your Gemfile." end |
.to_xsd(_klass, _options = {}) ⇒ Object
XML-specific methods (to_xsd, to_relaxng, from_xml) are registered by Lutaml::Xml at load time via register_method. If called without XML loaded, raise a helpful error.
65 66 67 |
# File 'lib/lutaml/model/schema.rb', line 65 def self.to_xsd(_klass, = {}) raise "XSD schema generation requires lutaml-xml. Add it to your Gemfile." end |
.to_yaml(klass, options = {}) ⇒ Object
58 59 60 |
# File 'lib/lutaml/model/schema.rb', line 58 def self.to_yaml(klass, = {}) YamlSchema.generate(klass, ) end |