Module: Shale::Schema Private
- Defined in:
- lib/shale/schema.rb,
lib/shale/schema/xml_compiler.rb,
lib/shale/schema/compiler/date.rb,
lib/shale/schema/compiler/time.rb,
lib/shale/schema/json_compiler.rb,
lib/shale/schema/xml_generator.rb,
lib/shale/schema/compiler/float.rb,
lib/shale/schema/compiler/value.rb,
lib/shale/schema/json_generator.rb,
lib/shale/schema/compiler/string.rb,
lib/shale/schema/compiler/boolean.rb,
lib/shale/schema/compiler/complex.rb,
lib/shale/schema/compiler/integer.rb,
lib/shale/schema/compiler/property.rb,
lib/shale/schema/json_generator/ref.rb,
lib/shale/schema/json_generator/base.rb,
lib/shale/schema/json_generator/date.rb,
lib/shale/schema/json_generator/time.rb,
lib/shale/schema/compiler/xml_complex.rb,
lib/shale/schema/json_generator/float.rb,
lib/shale/schema/json_generator/value.rb,
lib/shale/schema/xml_generator/import.rb,
lib/shale/schema/xml_generator/schema.rb,
lib/shale/schema/compiler/xml_property.rb,
lib/shale/schema/json_generator/object.rb,
lib/shale/schema/json_generator/schema.rb,
lib/shale/schema/json_generator/string.rb,
lib/shale/schema/xml_generator/element.rb,
lib/shale/schema/json_generator/boolean.rb,
lib/shale/schema/json_generator/integer.rb,
lib/shale/schema/xml_generator/attribute.rb,
lib/shale/schema/json_generator/collection.rb,
lib/shale/schema/xml_generator/ref_element.rb,
lib/shale/schema/xml_generator/complex_type.rb,
lib/shale/schema/xml_generator/ref_attribute.rb,
lib/shale/schema/xml_generator/typed_element.rb,
lib/shale/schema/xml_generator/typed_attribute.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Module for handling JSON and XML schema
Defined Under Namespace
Modules: Compiler Classes: JSONCompiler, JSONGenerator, XMLCompiler, XMLGenerator
Class Method Summary collapse
-
.from_json(schemas, root_name: nil, namespace_mapping: nil) ⇒ Array<String>
Generate Shale model from JSON Schema.
-
.from_xml(schemas, namespace_mapping: nil) ⇒ Array<String>
Generate Shale model from XML Schema.
-
.to_json(klass, id: nil, title: nil, description: nil, pretty: false) ⇒ String
Generate JSON Schema from Shale model.
-
.to_xml(klass, base_name = nil, pretty: false, declaration: false) ⇒ Hash<String, String>
Generate XML Schema from Shale model.
Class Method Details
.from_json(schemas, root_name: nil, namespace_mapping: nil) ⇒ Array<String>
Generate Shale model from JSON Schema
50 51 52 53 54 55 56 |
# File 'lib/shale/schema.rb', line 50 def self.from_json(schemas, root_name: nil, namespace_mapping: nil) JSONCompiler.new.to_models( schemas, root_name: root_name, namespace_mapping: namespace_mapping ) end |
.from_xml(schemas, namespace_mapping: nil) ⇒ Array<String>
Generate Shale model from XML Schema
88 89 90 |
# File 'lib/shale/schema.rb', line 88 def self.from_xml(schemas, namespace_mapping: nil) XMLCompiler.new.to_models(schemas, namespace_mapping: namespace_mapping) end |
.to_json(klass, id: nil, title: nil, description: nil, pretty: false) ⇒ String
Generate JSON Schema from Shale model
27 28 29 30 31 32 33 34 35 |
# File 'lib/shale/schema.rb', line 27 def self.to_json(klass, id: nil, title: nil, description: nil, pretty: false) JSONGenerator.new.to_schema( klass, id: id, title: title, description: description, pretty: pretty ) end |
.to_xml(klass, base_name = nil, pretty: false, declaration: false) ⇒ Hash<String, String>
Generate XML Schema from Shale model
72 73 74 |
# File 'lib/shale/schema.rb', line 72 def self.to_xml(klass, base_name = nil, pretty: false, declaration: false) XMLGenerator.new.to_schemas(klass, base_name, pretty: pretty, declaration: declaration) end |