question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with generating enumLeafs

See original GitHub issue

I’m using this schema file ` <?xml version=“1.0” encoding=“UTF-8”?> <xsd:schema xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns=“http://foo.bar.EnumLeafSchema” targetNamespace=“http://foo.bar.EnumLeafSchema” elementFormDefault=“qualified”>

<xsd:element name=“UsesEnumLeaf”> <xsd:complexType> <xsd:sequence> <xsd:element name=“personTitle” type=“PersonTitleCodesEnumeration”></xsd:element> <xsd:element name=“personName” type=“xsd:string”></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element>

<xsd:simpleType name=“PersonTitleCodesEnumeration”> <xsd:restriction base=“xsd:string”> <xsd:enumeration value=“mr” /> <xsd:enumeration value=“ms” /> <xsd:enumeration value=“mrs” /> <xsd:enumeration value=“miss” /> <xsd:enumeration value=“dr” /> </xsd:restriction> </xsd:simpleType>

</xsd:schema> `

This is generated by the compiler:

var enumleafschema_bar_foo_Module_Factory = function () {
  var enumleafschema_bar_foo = {
    name: 'enumleafschema_bar_foo',
    defaultElementNamespaceURI: 'http:\/\/foo.bar.EnumLeafSchema',
    typeInfos: [{
        localName: 'UsesEnumLeaf',
        typeName: null,
        propertyInfos: [{
            name: 'personTitle',
            required: true
          }, {
            name: 'personName',
            required: true
          }]
      }, {
        type: 'enumInfo',
        localName: 'PersonTitleCodesEnumeration',
        values: ['mr', 'ms', 'mrs', 'miss', 'dr']
      }],
    elementInfos: [{
        elementName: 'UsesEnumLeaf',
        typeInfo: '.UsesEnumLeaf'
      }]
  };
  return {
    enumleafschema_bar_foo: enumleafschema_bar_foo
  };
};

But I expected:

localName: 'UsesEnumLeaf',
        typeName: null,
        propertyInfos: [{
            name: 'personTitle',
            required: true,
//This was missing in the generated mapping
            typeInfo: '.PersonTitleCodesEnumeration'
          }, {
            name: 'personName',
            required: true
          }]

Is this a bug? My failure?

Kind regards,

Tom

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
highsourcecommented, Jul 27, 2016

Coming this week. There’s one small problem to be solved with hierarchican allOfs.

0reactions
benmarchcommented, Aug 3, 2016

Thanks, @highsource! Works perfectly for me in 2.3.9.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems with setting up an enum type - java - Stack Overflow
You've defined an option enum but not an option instance variable. This: private enum option {cleanKit, seatCush, padFeet};.
Read more >
Cannot retrieve enum values from typedeffed type #635 - GitHub
Hi, we have no nice API for creating enum leaves based on their value, it did not even occur to me. So, you...
Read more >
8 Reasons Why MySQL's ENUM Data Type Is Evil
MySQL's ENUM data-type is a hot spot that sometimes generates strong opinions among developers. At first glance it seems like an efficient ...
Read more >
Best Practices Using Enums in .NET - Coding Helmet
When looking just at the output, the problem seems to be resolved. But internally, the problem remains. Just take a look at the...
Read more >
How Enums Spread Disease — And How To Cure It - Codecraft
Poorly handled enums can infect code with fragility and tight coupling like a digital Typhoid Mary. Here's a cure.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found