mbt-gen 0.0.6 → 0.0.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mbt-gen.rb +16 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d73853b99bf4d38c5c621765537531713eca02dcf357d2b2c004514c66fa78f7
4
- data.tar.gz: 99b8a8490a1a33662b5a044cb466fdb95875dfe2e1ba8f031065d6a58dc170c7
3
+ metadata.gz: 60f33b703c44710c8f3fd4ac743eda550f72af721e6480beb9c62d4e7d1258c7
4
+ data.tar.gz: 53f6012841f8572350c02cffa8fb841ae7de411985c15c21f7c7e02465e191f5
5
5
  SHA512:
6
- metadata.gz: 11787320c7d53d3f0d14686f0d1224daee62522e6298175a02c3c1ad11f30f8ed564526fa773599125b2ea9c5cffd647298ac50449495661ef5d5f3d078ba5ce
7
- data.tar.gz: 45aef9d1c6c316aa145c1cc50a88319ae50390d676df64bb5abf7b86a5baf0612f19b27c347e44efeba1bf5c1f15c3f76e1e5fae0779f84df4145b13561ee92b
6
+ metadata.gz: 9143a6315fa8e359420862a2e0d8d6dbaf08efb2ae9f749d3f51a178f55ffc619602d098dba6e518cfb606a92fb5f730d2fb627216320817d37aa38a2dc706fd
7
+ data.tar.gz: 292e6fa9e9dc391c906b6d3ee305edc8c7c8a74b39e345380813014177c4d7c68753dfe46eb37ce64ff6ec8aa24f8da261ab97f797d44430fe72aa0ba363934d
data/lib/mbt-gen.rb CHANGED
@@ -596,6 +596,15 @@ def translate_validation_rule_to_SMTLIB(rule, context_struct, prefix, config, op
596
596
  field = resolve_field_path($1, context_struct, prefix)
597
597
  filled_var_for_field(field)
598
598
  end
599
+ .gsub(/LIST_VALUE\[[^\]]*,[^\]]*\]/) do |m|
600
+ unless m =~ /LIST_VALUE\[([^\]]*),([^\]]*)\]/ then
601
+ raise RuntimeError.new("could not parse LIST_VALUE_FIRST_ELEMENT[...]: #{m.inspect} in validation rule #{rule_name}")
602
+ end
603
+ xpath = $1
604
+ index = Integer($2)
605
+ l = resolve_field_path(xpath, context_struct, prefix)
606
+ value_var_for_list(l, index)
607
+ end
599
608
  .gsub(/VALUE\[[^\]]*\]/) do |m|
600
609
  unless m =~ /VALUE\[([^\]]*)\]/ then
601
610
  raise RuntimeError.new("could not parse VALUE[...]: #{m.inspect} in validation rule #{rule_name}")
@@ -630,15 +639,6 @@ def translate_validation_rule_to_SMTLIB(rule, context_struct, prefix, config, op
630
639
  end
631
640
  "(or #{terms.join(" ")})"
632
641
  end
633
- .gsub(/LIST_VALUE\[[^\]]*,[^\]]*\]/) do |m|
634
- unless m =~ /LIST_VALUE\[([^\]]*),([^\]]*)\]/ then
635
- raise RuntimeError.new("could not parse LIST_VALUE_FIRST_ELEMENT[...]: #{m.inspect} in validation rule #{rule_name}")
636
- end
637
- xpath = $1
638
- index = Integer($2)
639
- l = resolve_field_path(xpath, context_struct, prefix)
640
- value_var_for_list(l, index)
641
- end
642
642
  .gsub(/LIST_VALUE_FIRST_ELEMENT\[[^\]]*\]/) do |m| # DEPRECATED! Please use LIST_VALUE[...] instead.
643
643
  unless m =~ /LIST_VALUE_FIRST_ELEMENT\[([^\]]*)\]/ then
644
644
  raise RuntimeError.new("could not parse LIST_VALUE_FIRST_ELEMENT[...]: #{m.inspect} in validation rule #{rule_name}")
@@ -1723,7 +1723,13 @@ def validate_model(message, prefix=nil)
1723
1723
  end
1724
1724
  elsif value[:type] == :list then
1725
1725
  unless value[:datatype] then
1726
- raise RuntimeError.new("Model Problem: encountered list without a :datatype (key=#{key.inspect}, value=#{value.inspect})")
1726
+ raise RuntimeError.new("Model Problem: encountered list without :datatype property (key=#{key.inspect}, value=#{value.inspect})")
1727
+ end
1728
+ unless value[:model_maxLength] then
1729
+ raise RuntimeError.new("Model Problem: encountered list without :model_maxLength property (key=#{key.inspect}, value=#{value.inspect})")
1730
+ end
1731
+ unless value[:xpath_element] then
1732
+ raise RuntimeError.new("Model Problem: encountered list without :xpath_element property (key=#{key.inspect}, value=#{value.inspect})")
1727
1733
  end
1728
1734
  if value[:datatype] == :enum then
1729
1735
  unless value[:values] then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbt-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - FM-enthusiast