From 3b227f1d7248ca103e43a4c2aafdb0c29a11faef Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Tue, 15 Jun 2021 13:51:07 -0400 Subject: [PATCH] Build missing data objects from wsdl --- devel/verify-vim-wsdl.rb | 27 +++++++++++++++++++++++++-- vmodl.db | Bin 1064345 -> 1064457 bytes 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/devel/verify-vim-wsdl.rb b/devel/verify-vim-wsdl.rb index 7186ef4..074fe56 100755 --- a/devel/verify-vim-wsdl.rb +++ b/devel/verify-vim-wsdl.rb @@ -74,7 +74,9 @@ def wsdl_constantize(type) # Loop through the ComplexTypes in the WSDL and compare their types # to the types which are defined in the vmodl.db -vim.collect_complextypes.each do |type| +wsdl_types_by_name = vim.collect_complextypes.index_by { |type| type.name.name } + +wsdl_types_by_name.each_value do |type| type_name = type.name.name next if type_name.match?(/^ArrayOf/) || type_name.match(/RequestType$/) @@ -87,7 +89,28 @@ def wsdl_constantize(type) # Print a warning that the type is missing and skip it. if vmodl_data.nil? puts " #{type_name} is missing" - next + next unless options[:fix] + + base_class = wsdl_types_by_name[type.complexcontent.extension.base.name] + inherited_properties = base_class.elements.map { |element| element.name.name } + properties = type.elements.reject { |e| inherited_properties.include?(e.name.name) } + + vmodl_data = { + 'kind' => 'data', + 'props' => properties.map do |element| + { + 'name' => element.name.name, + 'is-optional' => element.minoccurs == 0, + 'is-array' => element.maxoccurs != 1, + 'version-id-ref' => nil, + 'wsdl_type' => wsdl_to_vmodl_type(element.type.name) + } + end, + 'wsdl_base' => type.complexcontent.extension.base.name + } + + vmodl[type_name] = vmodl_data + vmodl['_typenames']['_typenames'] << type_name end # Index the properties by name to make it simpler to find later diff --git a/vmodl.db b/vmodl.db index 73f8b0c3b0d6a2da8aece5fe450fe280e417c3ff..15fc8742f76699c8b46566f5e74f5db7fc3bba25 100644 GIT binary patch delta 174 zcmbRF+oAK1LqiK=3sVbo3rh=Y3tJ0&3r7oQ3s(zw3r`Dg3ttQW7J+cn>G47={L|l` z<UXe!XeIQ{HJ9+BzSm3jH6XJ6&xnyzFnuxEP1S&-O9e*WnW#sY%VL#+fvrb}1| z9GiaYIZ&d&SU_z1FAD(+#_9geK>jRa0oiG*SXj14S_!OUoWAlfQ0$?xfc$nH8v#~E Sh+#}70>ab1Yz4eQT7&@HLpuBb delta 152 zcmeDD<1q8LLqiK=3sVbo3rh=Y3tJ0&3r7oQ3s(zw3r`Dg3ttQW7J+cn=@U436{Z`g zv9K}u9NOM%D$v5n;s9h$7cdr(pRQ*iz&qXFTwpasOy5{Q2_$w4!p$=lkl1cyDPRH7 dvc1Mi;3AY6ZzG@vVNNp<5S_lpR=^vq2LSEcEY$!2