lutaml-model 0.8.196 → 0.8.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/_references/plan-schema-spec.adoc +308 -0
- data/lib/compat/opal/lutaml_model_boot.rb +1 -0
- data/lib/lutaml/lml/format/adapter/standard_adapter.rb +10 -3
- data/lib/lutaml/lml/models/top_element_attribute.rb +7 -2
- data/lib/lutaml/model/serialize/annotations.rb +74 -0
- data/lib/lutaml/model/serialize.rb +2 -0
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/mapping.rb +15 -0
- data/lib/lutaml/xml/schema/xsd/attribute.rb +3 -0
- data/lib/lutaml/xml/schema/xsd/element.rb +3 -0
- data/lib/lutaml/xml/schema/xsd/max_scale.rb +25 -0
- data/lib/lutaml/xml/schema/xsd/min_scale.rb +25 -0
- data/lib/lutaml/xml/schema/xsd/restriction_simple_type.rb +9 -0
- data/lib/lutaml/xml/schema/xsd/vc_conditional_attributes.rb +62 -0
- data/lib/lutaml/xml/schema/xsd.rb +6 -2
- data/lib/lutaml/xml/schema/xsd_schema.rb +2 -0
- data/spec/lml/lutaml/lml/format_adapter_spec.rb +24 -0
- data/spec/lml/lutaml/lml/json_transfer_spec.rb +188 -0
- data/spec/lml/lutaml/lml/property_laws_spec.rb +3 -38
- data/spec/lml/support/lml_property_support.rb +168 -0
- data/spec/lutaml/model/annotations_spec.rb +97 -0
- data/spec/lutaml/xml/schema/xsd_scale_vc_spec.rb +59 -0
- metadata +10 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.describe "XSD 1.1 scale facets and component-level vc: attributes" do
|
|
6
|
+
let(:source) do
|
|
7
|
+
<<~XML
|
|
8
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
|
|
9
|
+
<xs:attribute name="x" use="required" vc:typeUnavailable="xs:integer"/>
|
|
10
|
+
<xs:element name="e" vc:minVersion="1.1"/>
|
|
11
|
+
<xs:simpleType name="decMinMaxScale">
|
|
12
|
+
<xs:restriction base="xs:precisionDecimal">
|
|
13
|
+
<xs:minScale value="2"/>
|
|
14
|
+
<xs:maxScale value="3"/>
|
|
15
|
+
</xs:restriction>
|
|
16
|
+
</xs:simpleType>
|
|
17
|
+
</xs:schema>
|
|
18
|
+
XML
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
let(:root) { Lutaml::Xml::Schema::Xsd.parse(source, register: :xsd) }
|
|
22
|
+
|
|
23
|
+
describe "minScale/maxScale facets (XSD 1.1 §3.4.2)" do
|
|
24
|
+
it "parses the scale facets" do
|
|
25
|
+
restriction = root.simple_type.first.restriction
|
|
26
|
+
|
|
27
|
+
expect(restriction.min_scale.first.value).to eq(2)
|
|
28
|
+
expect(restriction.max_scale.first.value).to eq(3)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "round-trips the scale facets" do
|
|
32
|
+
xml = root.to_xml
|
|
33
|
+
|
|
34
|
+
expect(xml).to include("minScale")
|
|
35
|
+
expect(xml).to include("maxScale")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe "component-level vc: conditional attributes (XSD 1.1 §4.2)" do
|
|
40
|
+
it "parses the declaration-level spellings" do
|
|
41
|
+
expect(root.attribute.first.vc_type_unavailable).to eq("xs:integer")
|
|
42
|
+
expect(root.element.first.vc_min_version).to eq("1.1")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "round-trips with the vc: namespace" do
|
|
46
|
+
xml = root.to_xml
|
|
47
|
+
|
|
48
|
+
expect(xml).to include("vc:typeUnavailable")
|
|
49
|
+
expect(xml).to include("vc:minVersion")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "absent vc: attributes stay absent" do
|
|
53
|
+
xml = root.to_xml
|
|
54
|
+
|
|
55
|
+
expect(xml).not_to include("vc:typeAvailable")
|
|
56
|
+
expect(xml).not_to include("vc:facetUnavailable")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.197
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -295,6 +295,7 @@ files:
|
|
|
295
295
|
- docs/_references/instance-serialization.adoc
|
|
296
296
|
- docs/_references/lutaml-namespace-planning.md
|
|
297
297
|
- docs/_references/parent-root-context.adoc
|
|
298
|
+
- docs/_references/plan-schema-spec.adoc
|
|
298
299
|
- docs/_references/rdf-namespaces.adoc
|
|
299
300
|
- docs/_references/reference_type.adoc
|
|
300
301
|
- docs/_references/serialization-model-mappings.adoc
|
|
@@ -752,6 +753,7 @@ files:
|
|
|
752
753
|
- lib/lutaml/model/serializable.rb
|
|
753
754
|
- lib/lutaml/model/serialization_adapter.rb
|
|
754
755
|
- lib/lutaml/model/serialize.rb
|
|
756
|
+
- lib/lutaml/model/serialize/annotations.rb
|
|
755
757
|
- lib/lutaml/model/serialize/attribute_definition.rb
|
|
756
758
|
- lib/lutaml/model/serialize/builder.rb
|
|
757
759
|
- lib/lutaml/model/serialize/conversion_caching.rb
|
|
@@ -1023,9 +1025,11 @@ files:
|
|
|
1023
1025
|
- lib/lutaml/xml/schema/xsd/max_exclusive.rb
|
|
1024
1026
|
- lib/lutaml/xml/schema/xsd/max_inclusive.rb
|
|
1025
1027
|
- lib/lutaml/xml/schema/xsd/max_length.rb
|
|
1028
|
+
- lib/lutaml/xml/schema/xsd/max_scale.rb
|
|
1026
1029
|
- lib/lutaml/xml/schema/xsd/min_exclusive.rb
|
|
1027
1030
|
- lib/lutaml/xml/schema/xsd/min_inclusive.rb
|
|
1028
1031
|
- lib/lutaml/xml/schema/xsd/min_length.rb
|
|
1032
|
+
- lib/lutaml/xml/schema/xsd/min_scale.rb
|
|
1029
1033
|
- lib/lutaml/xml/schema/xsd/namespace_mapping.rb
|
|
1030
1034
|
- lib/lutaml/xml/schema/xsd/namespace_uri_remapping.rb
|
|
1031
1035
|
- lib/lutaml/xml/schema/xsd/notation.rb
|
|
@@ -1053,6 +1057,7 @@ files:
|
|
|
1053
1057
|
- lib/lutaml/xml/schema/xsd/unique.rb
|
|
1054
1058
|
- lib/lutaml/xml/schema/xsd/validation_error.rb
|
|
1055
1059
|
- lib/lutaml/xml/schema/xsd/validation_result.rb
|
|
1060
|
+
- lib/lutaml/xml/schema/xsd/vc_conditional_attributes.rb
|
|
1056
1061
|
- lib/lutaml/xml/schema/xsd/version.rb
|
|
1057
1062
|
- lib/lutaml/xml/schema/xsd/white_space.rb
|
|
1058
1063
|
- lib/lutaml/xml/schema/xsd_namespace.rb
|
|
@@ -1971,6 +1976,7 @@ files:
|
|
|
1971
1976
|
- spec/lml/lutaml/lml/has_attributes_spec.rb
|
|
1972
1977
|
- spec/lml/lutaml/lml/import_resolver_spec.rb
|
|
1973
1978
|
- spec/lml/lutaml/lml/instance_hydration_spec.rb
|
|
1979
|
+
- spec/lml/lutaml/lml/json_transfer_spec.rb
|
|
1974
1980
|
- spec/lml/lutaml/lml/lsp/server_spec.rb
|
|
1975
1981
|
- spec/lml/lutaml/lml/model_compiler_spec.rb
|
|
1976
1982
|
- spec/lml/lutaml/lml/models/association_spec.rb
|
|
@@ -2009,6 +2015,7 @@ files:
|
|
|
2009
2015
|
- spec/lml/lutaml/parsers/dsl_spec.rb
|
|
2010
2016
|
- spec/lml/lutaml/parsers/yaml_spec.rb
|
|
2011
2017
|
- spec/lml/lutaml/qualified_type_spec.rb
|
|
2018
|
+
- spec/lml/support/lml_property_support.rb
|
|
2012
2019
|
- spec/lutaml/integration/edge_cases_spec.rb
|
|
2013
2020
|
- spec/lutaml/integration/multi_format_spec.rb
|
|
2014
2021
|
- spec/lutaml/integration/round_trip_spec.rb
|
|
@@ -2028,6 +2035,7 @@ files:
|
|
|
2028
2035
|
- spec/lutaml/model/adapter_resolver_configured_spec.rb
|
|
2029
2036
|
- spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb
|
|
2030
2037
|
- spec/lutaml/model/adapter_type_unset_restore_spec.rb
|
|
2038
|
+
- spec/lutaml/model/annotations_spec.rb
|
|
2031
2039
|
- spec/lutaml/model/any_element_mapping_spec.rb
|
|
2032
2040
|
- spec/lutaml/model/attribute_apply_value_map_spec.rb
|
|
2033
2041
|
- spec/lutaml/model/attribute_collection_spec.rb
|
|
@@ -2415,6 +2423,7 @@ files:
|
|
|
2415
2423
|
- spec/lutaml/xml/schema/xsd/vc_versioning_spec.rb
|
|
2416
2424
|
- spec/lutaml/xml/schema/xsd/xsd_11_constructs_spec.rb
|
|
2417
2425
|
- spec/lutaml/xml/schema/xsd/xsd_spec.rb
|
|
2426
|
+
- spec/lutaml/xml/schema/xsd_scale_vc_spec.rb
|
|
2418
2427
|
- spec/lutaml/xml/schema_primer_spec.rb
|
|
2419
2428
|
- spec/lutaml/xml/serializable_namespace_spec.rb
|
|
2420
2429
|
- spec/lutaml/xml/shared_element_rules_spec.rb
|