willemdj / erlsom

XML parser for Erlang
GNU Lesser General Public License v3.0
265 stars 103 forks source link

Breaking change in erlsom.simple_form/1 between 1.5.0 and 1.5.1 #92

Closed kuffel closed 8 months ago

kuffel commented 9 months ago

There is a breaking change in the output of erlsom:simple_form that was introduced with this merge: https://github.com/willemdj/erlsom/pull/77

Is it possible to introduce an option to make this behavior configurable?

Before:

{:model,
 [
   {:type, :_document, :sequence,
    [
      {:el,
       [
         {:alt, :otherComplexType, :otherComplexType, [], 1, 1, true,
          :undefined}
       ], 1, 1, :undefined, 2}
    ], [], :undefined, :undefined, 1, 1, 1, false, :undefined},
   {:type, :"otherComplexType-someChoiceA", :sequence, [],
    [{:att, :type, 2, false, :char}, {:att, :time, 3, false, :char}],
    :undefined, :undefined, 3, 1, 1, :undefined, :undefined},
   {:type, :"otherComplexType-someChoiceB", :sequence, [],
    [{:att, :type, 2, false, :char}, {:att, :time, 3, false, :char}],
    :undefined, :undefined, 3, 1, 1, :undefined, :undefined},
   {:type, :otherComplexType, :sequence,
    [
      {:el,
       [
         {:alt, :someChoiceB, :"otherComplexType-someChoiceB", [], 1, 1, true,
          :undefined},
         {:alt, :someChoiceA, :"otherComplexType-someChoiceA", [], 1, 1, true,
          :undefined}
       ], 1, 1, :undefined, 2}
    ], [], :undefined, :undefined, 2, 1, 1, :undefined, :undefined},
   {:type, :someComplexType, :sequence, [],
    [{:att, :type, 2, false, :char}, {:att, :time, 3, false, :char}],
    :undefined, :undefined, 3, 1, 1, :undefined, :undefined}
 ],
 [
   {:ns, ~c"http://www.w3.org/2001/XMLSchema", ~c"xsd", :qualified},
   {:ns, ~c"urn:minimal", :undefined, :unqualified}
 ], ~c"urn:minimal", [], false, :skip}

After:

{:model,
 [
   {:type, :_document, :sequence,
    [
      {:el,
       [
         {:alt, :otherComplexType, :otherComplexType, [], 1, 1, true,
          :undefined}
       ], 1, 1, :undefined, 2}
    ], [], :undefined, :undefined, 1, 1, 1, false, :undefined},
   {:type, :otherComplexType_someChoiceA, :sequence,
    [
      {:el,
       [{:alt, :someChoiceA, :someComplexType, [], 1, 1, true, :undefined}], 1,
       1, :undefined, 2}
    ], [], :undefined, :undefined, 2, 1, 1, false, :undefined},
   {:type, :otherComplexType_someChoiceB, :sequence,
    [
      {:el,
       [{:alt, :someChoiceB, :someComplexType, [], 1, 1, true, :undefined}], 1,
       1, :undefined, 2}
    ], [], :undefined, :undefined, 2, 1, 1, false, :undefined},
   {:type, :otherComplexType, :sequence,
    [
      {:el,
       [
         {:alt, :someChoiceB, :otherComplexType_someChoiceB, [], 1, 1, false,
          :undefined},
         {:alt, :someChoiceA, :otherComplexType_someChoiceA, [], 1, 1, false,
          :undefined}
       ], 1, 1, :undefined, 2}
    ], [], :undefined, :undefined, 2, 1, 1, :undefined, :undefined},
   {:type, :someComplexType, :sequence, [],
    [{:att, :type, 2, false, :char}, {:att, :time, 3, false, :char}],
    :undefined, :undefined, 3, 1, 1, :undefined, :undefined}
 ],
 [
   {:ns, ~c"http://www.w3.org/2001/XMLSchema", ~c"xsd", :qualified},
   {:ns, ~c"urn:minimal", :undefined, :unqualified}
 ], ~c"urn:minimal", [], false, :skip}
willemdj commented 9 months ago

I am not sure I understand what you mean, can you give a bit more detail about what you are trying to achieve?

The example that you give doesn't show output from erlsom:simple_form, I would say. It shows a "model": the internal representation of the xsd. It is true that this has changed, but it is not supposed to be interpreted by the user of erlsom (it is not documented).

willemdj commented 8 months ago

Cleaning up, I am assuming that this was somehow based on a misunderstanding.