XML provider: Infered type should be record type #294

Closed
tpetricek opened this Issue Dec 18, 2013 · 3 comments

Projects

None yet

2 participants

@tpetricek
Member

There is something wrong with list of samples in XML provider:

type AnyFeed = XmlProvider<"http://pastebin.com/raw.php?i=sGPv5ac4",SampleIsList=true>

Tutorial.fsx(7,16): error FS3033: The type provider 'ProviderImplementation.XmlProvider' reported an error: generateXmlType: Infered type should be record type.

@ovatsus Unless you have some immediate idea what is causing this, I'm happy to have a look at this tomorrow.

Also, I forgot we renamed SampleList to SampleIsList and thought it was a typo because I was reading it as SamplelsList. But that is probably just my stupidity and lack of sleep recently!

@ovatsus
Member
ovatsus commented Dec 18, 2013

This happens both in 1.1.10 and in 2.0-alpha

@ovatsus
Member
ovatsus commented Dec 19, 2013

Changing the error line to output more info | x -> failwithf "generateXmlType: Infered type should be record type: %A" x:

I get this:

Error   1   The type provider 'ProviderImplementation.XmlProvider' reported an error: generateXmlType: Infered type should be record type: Heterogeneous
  (map
     [(Record (Some "rss"),
       Record
         (Some "rss",
          [{Name = "version";
            Optional = false;
            Type = Primitive (System.Decimal,null);};
           {Name = "";
            Optional = false;
            Type =
             Collection
               (map
                  [(Record (Some "channel"),
                    (Single,
                     Record
                       (Some "channel",
                        [{Name = "";
                          Optional = false;
                          Type =
                           Collection
                             (map
                                [(Record (Some "description"),
                                  (Single,
                                   Record
                                     (Some "description",
                                      [{Name = "";
                                        Optional = false;
                                        Type = Primitive (System.String,null);}])));
                                 (Record (Some "item"),
                                  (Multiple,
                                   Record
                                     (Some "item",
                                      [{Name = "";
                                        Optional = false;
                                        Type =
                                         Collection
                                           (map
                                              [(Record (Some "description"),
                                                (Single,
                                                 Record
                                                   (Some "description",
                                                    [{Name = "";
                                                      Optional = false;
                                                      Type =
                                                       Primitive
                                                         (System.String,null);}])));
                                               (Record (Some "link"),
                                                (Single,
                                                 Record
                                                   (Some "link",
                                                    [{Name = "";
                                                      Optional = false;
                                                      Type =
                                                       Primitive
                                                         (System.String,null);}])));
                                               (Record (Some "title"),
                                                (Single,
                                                 Record
                                                   (Some "title",
                                                    [{Name = "";
                                                      Optional = false;
                                                      Type =
                                                       Primitive
                                                         (System.String,null);}])))]);}])));
                                 (Record (Some "link"),
                                  (Single,
                                   Record
                                     (Some "link",
                                      [{Name = "";
                                        Optional = false;
                                        Type = Primitive (System.String,null);}])));
                                 (Record (Some "title"),
                                  (Single,
                                   Record
                                     (Some "title",
                                      [{Name = "";
                                        Optional = false;
                                        Type = Primitive (System.String,null);}])))]);}])))]);}]));
      (Record (Some "{http://www.w3.org/2005/Atom}feed"),
       Record
         (Some "{http://www.w3.org/2005/Atom}feed",
          [{Name = "xmlns";
            Optional = false;
            Type = Primitive (System.String,null);};
           {Name = "";
            Optional = false;
            Type =
             Collection
               (map
                  [(Record (Some "{http://www.w3.org/2005/Atom}entry"),
                    (Single,
                     Record
                       (Some "{http://www.w3.org/2005/Atom}entry",
                        [{Name = "";
                          Optional = false;
                          Type =
                           Collection
                             (map
                                [(Record
                                    (Some "{http://www.w3.org/2005/Atom}author"),
                                  (Single,
                                   Record
                                     (Some "{http://www.w3.org/2005/Atom}author",
                                      [{Name = "";
                                        Optional = false;
                                        Type =
                                         Collection
                                           (map
                                              [(Record
                                                  (Some
                                                     "{http://www.w3.org/2005/Atom}email"),
                                                (Single,
                                                 Record
                                                   (Some
                                                      "{http://www.w3.org/2005/Atom}email",
                                                    [{Name = "";
                                                      Optional = false;
                                                      Type =
                                                       Primitive
                                                         (System.String,null);}])));
                                               (Record
                                                  (Some
                                                     "{http://www.w3.org/2005/Atom}name"),
                                                (Single,
                                                 Record
                                                   (Some
                                                      "{http://www.w3.org/2005/Atom}name",
                                                    [{Name = "";
                                                      Optional = false;
                                                      Type =
                                                       Primitive
                                                         (System.String,null);}])))]);}])));
                                 (Record
                                    (Some "{http://www.w3.org/2005/Atom}id"),
                                  (Single,
                                   Record
                                     (Some "{http://www.w3.org/2005/Atom}id",
                                      [{Name = "";
                                        Optional = false;
                                        Type = Primitive (System.String,null);}])));
                                 (Record
                                    (Some "{http://www.w3.org/2005/Atom}link"),
                                  (Multiple,
                                   Record
                                     (Some "{http://www.w3.org/2005/Atom}link",
                                      [{Name = "href";
                                        Optional = false;
                                        Type = Primitive (System.String,null);};
                                       {Name = "rel";
                                        Optional = true;
                                        Type = Primitive (System.String,null);};
                                       {Name = "type";
                                        Optional = true;
                                        Type = Primitive (System.String,null);}])));
                                 (Record
                                    (Some "{http://www.w3.org/2005/Atom}summary"),
                                  (Single,
                                   Record
                                     (Some
                                        "{http://www.w3.org/2005/Atom}summary",
                                      [{Name = "";
                                        Optional = false;
                                        Type = Primitive (System.String,null);}])));
                                 (Record
                                    (Some "{http://www.w3.org/2005/Atom}title"),
                                  (Single,
                                   Record
                                     (Some "{http://www.w3.org/2005/Atom}title",
                                      [{Name = "";
                                        Optional = false;
                                        Type = Primitive (System.String,null);}])));
                                 (Record
                                    (Some "{http://www.w3.org/2005/Atom}updated"),
                                  (Single,
                                   Record
                                     (Some
                                        "{http://www.w3.org/2005/Atom}updated",
                                      [{Name = "";
                                        Optional = false;
                                        Type = Primitive (System.DateTime,null);}])))]);}])));
                   (Record (Some "{http://www.w3.org/2005/Atom}id"),
                    (Single,
                     Record
                       (Some "{http://www.w3.org/2005/Atom}id",
                        [{Name = "";
                          Optional = false;
                          Type = Primitive (System.String,null);}])));
                   (Record (Some "{http://www.w3.org/2005/Atom}link"),
                    (Multiple,
                     Record
                       (Some "{http://www.w3.org/2005/Atom}link",
                        [{Name = "href";
                          Optional = false;
                          Type = Primitive (System.String,null);};
                         {Name = "rel";
                          Optional = true;
                          Type = Primitive (System.String,null);}])));
                   (Record (Some "{http://www.w3.org/2005/Atom}subtitle"),
                    (Single,
                     Record
                       (Some "{http://www.w3.org/2005/Atom}subtitle",
                        [{Name = "";
                          Optional = false;
                          Type = Primitive (System.String,null);}])));
                   (Record (Some "{http://www.w3.org/2005/Atom}title"),
                    (Single,
                     Record
                       (Some "{http://www.w3.org/2005/Atom}title",
                        [{Name = "";
                          Optional = false;
                          Type = Primitive (System.String,null);}])));
                   (Record (Some "{http://www.w3.org/2005/Atom}updated"),
                    (Single,
                     Record
                       (Some "{http://www.w3.org/2005/Atom}updated",
                        [{Name = "";
                          Optional = false;
                          Type = Primitive (System.DateTime,null);}])))]);}]))])
@ovatsus
Member
ovatsus commented Dec 19, 2013

Also, inspecting the toplevel inferedType, it's a heteregeneous type

@tpetricek tpetricek closed this in d876f2a Dec 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment