-
Notifications
You must be signed in to change notification settings - Fork 127
Create a schema for the LinkAttribute XML files #2500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
8cc539b
abac411
5f3bdad
79ae2c2
ed7b9e9
f837645
437f5cd
3ebd1fb
b142870
8f200b1
6838288
6f5eb8f
a1c1033
c8e9f4b
4c0cb95
f70da3d
fe36b38
9637260
504e4a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <xsd:schema attributeFormDefault="unqualified" | ||
| elementFormDefault="unqualified" | ||
| xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
|
|
||
| <xsd:complexType name="typechild"> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute"></xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| <xsd:attribute name="name" /> | ||
| <xsd:attribute name="signature" /> | ||
| </xsd:complexType> | ||
|
|
||
| <xsd:element name="method"> | ||
| <xsd:complexType> | ||
| <xsd:complexContent> | ||
| <xsd:extension base="typechild"> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element name="parameter"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute"></xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="name" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
| </xsd:choice> | ||
| <xsd:choice maxOccurs="1" minOccurs="0"> | ||
| <xsd:element name="return"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute"></xsd:element> | ||
| </xsd:choice> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
| </xsd:choice> | ||
| </xsd:choice> | ||
| </xsd:extension> | ||
| </xsd:complexContent> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="event"> | ||
| <xsd:complexType> | ||
| <xsd:complexContent> | ||
| <xsd:extension base="typechild" /> | ||
| </xsd:complexContent> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="field"> | ||
| <xsd:complexType> | ||
| <xsd:complexContent> | ||
| <xsd:extension base="typechild" /> | ||
| </xsd:complexContent> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="property"> | ||
| <xsd:complexType> | ||
| <xsd:complexContent> | ||
| <xsd:extension base="typechild" /> | ||
| </xsd:complexContent> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="argument"> | ||
| <xsd:complexType mixed="true"> | ||
| <xsd:choice minOccurs="0" maxOccurs="1"> | ||
| <xsd:element name="argument" type="xsd:string"/> | ||
| </xsd:choice> | ||
| <xsd:attribute name="type" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="attribute"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="argument" /> | ||
| <xsd:element minOccurs="0" maxOccurs="unbounded" name="property"> | ||
| <xsd:complexType mixed="true"> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute"></xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="name" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="internal" type="xsd:string" /> | ||
| <xsd:attribute name="fullname" type="xsd:string" /> | ||
| <xsd:attribute name="assembly" type="xsd:string" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="namespace"> | ||
| <xsd:complexType> | ||
| <xsd:attribute name="fullname"/> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="assembly"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute" /> | ||
| <xsd:element ref="type" /> | ||
| <xsd:element ref="namespace" /> | ||
| </xsd:choice> | ||
| <xsd:attribute name="fullname" type="xsd:string" use="required" /> | ||
| <xsd:attribute name="name" /> | ||
| <xsd:attribute name="signature" /> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="type"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute"></xsd:element> | ||
| <xsd:element ref="event" /> | ||
| <xsd:element ref="method" /> | ||
| <xsd:element ref="field" /> | ||
| <xsd:element ref="property" /> | ||
| <xsd:element name="type"> | ||
| <xsd:complexType> | ||
| <xsd:choice minOccurs="0" maxOccurs="unbounded"> | ||
| <xsd:element ref="event" /> | ||
| <xsd:element ref="method" /> | ||
| <xsd:element ref="field" /> | ||
| <xsd:element ref="property" /> | ||
| <xsd:element ref="attribute"></xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="name" type="xsd:string" /> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| </xsd:complexType> | ||
|
jtschuster marked this conversation as resolved.
Outdated
|
||
| </xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| <xsd:attribute name="fullname" type="xsd:string" use="required"/> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="linker"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="assembly" /> | ||
| <xsd:element ref="type" /> | ||
| </xsd:choice> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| </xsd:schema> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rename the file to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made this schema broad enough to cover
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm - I didn't see it there - does the ILLink.Attributes.xsd "inherit/include" the ILLink.xsd then?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the purpose of the schema? If we would like to give this to developers so that they have IntelliSense, having the schema suggest invalid values has potential to create harm (if there's no IntelliSense, one is forced to read docs; with IntelliSense, one relies on that for things that look "obvious"). Example: ILLink.Substitutions.xml will not look at
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one I started as a form of documentation before I realized how different each xml file is. I think that's a good point, this schema is a little too general to provide any value. I'll remove this file and only do the more specific schema. |
||
| <xsd:schema attributeFormDefault="unqualified" | ||
| elementFormDefault="unqualified" | ||
| xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
|
|
||
| <xsd:element name="method"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute" /> | ||
| <xsd:element name="parameter"> | ||
| <xsd:complexType> | ||
| <xsd:choice minOccurs="0" maxOccurs="unbounded"> | ||
| <xsd:element ref="attribute" /> | ||
| </xsd:choice> | ||
| <xsd:attribute name="name" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
| <xsd:element name="return"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute" /> | ||
| </xsd:choice> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="name" type="xsd:string" /> | ||
| <xsd:attribute name="signature" type="xsd:string" /> | ||
| <xsd:attribute name="required" type="xsd:boolean" /> | ||
| <xsd:attribute name="body" type="xsd:string" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: We could restrict this to the two supported values |
||
| <xsd:attribute name="value" type="xsd:string" /> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="event"> | ||
| <xsd:complexType> | ||
| <xsd:attribute name="name" type="xsd:string" /> | ||
| <xsd:attribute name="signature" type="xsd:string" /> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="field"> | ||
| <xsd:complexType> | ||
| <xsd:sequence> | ||
| <xsd:element minOccurs="0" maxOccurs="unbounded" ref="attribute" /> | ||
| </xsd:sequence> | ||
| <xsd:attribute name="name" type="xsd:string" /> | ||
| <xsd:attribute name="signature" type="xsd:string" /> | ||
| <xsd:attribute name="value" type="xsd:string" /> | ||
| <xsd:attribute name="initialize" type="xsd:string" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe make this In the parser, this has the same problem as preserve: value of |
||
| <xsd:attribute name="required" type="xsd:boolean" /> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="property"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="attribute" /> | ||
| </xsd:choice> | ||
| <xsd:attribute name="name" type="xsd:string"/> | ||
| <xsd:attribute name="signature" type="xsd:string" /> | ||
| <xsd:attribute name="required" type="xsd:boolean" /> | ||
| <xsd:attribute name="accessors" type="accessorvalues" /> | ||
| <xsd:attribute name="type" type="xsd:string" /> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="resource"> | ||
| <xsd:complexType> | ||
| <xsd:attribute name="name" use="required" /> | ||
| <xsd:attribute name="action" use="required" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a type that restricts this to |
||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| <xsd:attribute name="feature" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="argument"> | ||
| <xsd:complexType mixed="true"> | ||
| <xsd:choice minOccurs="0" maxOccurs="1"> | ||
| <xsd:element name="argument"> | ||
| <xsd:complexType> | ||
| <xsd:simpleContent> | ||
| <xsd:extension base="xsd:string"> | ||
| <xsd:attribute name="type" /> | ||
| </xsd:extension> | ||
| </xsd:simpleContent> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="type" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="attribute"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="argument" /> | ||
| <xsd:element minOccurs="0" maxOccurs="unbounded" name="property"> | ||
| <xsd:complexType> | ||
| <xsd:simpleContent> | ||
| <xsd:extension base="xsd:string"> | ||
| <xsd:attribute name="name" /> | ||
| </xsd:extension> | ||
| </xsd:simpleContent> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
| </xsd:choice> | ||
| <xsd:attribute name="internal" type="xsd:string" /> | ||
| <xsd:attribute name="fullname" type="xsd:string" /> | ||
| <xsd:attribute name="assembly" type="xsd:string" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="namespace"> | ||
| <xsd:complexType> | ||
| <xsd:attribute name="fullname"/> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="assembly"> | ||
| <xsd:complexType> | ||
| <xsd:choice minOccurs="0" maxOccurs="unbounded"> | ||
| <xsd:element minOccurs="0" maxOccurs="unbounded" ref="type" /> | ||
| <xsd:element minOccurs="0" maxOccurs="unbounded" ref="attribute" /> | ||
| <xsd:element minOccurs="0" maxOccurs="unbounded" ref="resource" /> | ||
| <xsd:element minOccurs="0" maxOccurs="unbounded" ref="namespace" /> | ||
| </xsd:choice> | ||
| <xsd:attribute name="fullname" type="xsd:string" use="required" /> | ||
| <xsd:attribute name="feature" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
| <xsd:attribute name="featuredefault" type="xsd:boolean" /> | ||
| <xsd:attribute name="preserve" type="preservevalues" /> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:simpleType name="preservevalues"> | ||
| <xsd:restriction base="xsd:string"> | ||
| <xsd:enumeration value="all" /> | ||
| <xsd:enumeration value="none" /> | ||
| <xsd:enumeration value="fields" /> | ||
| <xsd:enumeration value="methods" /> | ||
| </xsd:restriction> | ||
| </xsd:simpleType> | ||
|
|
||
| <xsd:simpleType name="accessorvalues"> | ||
| <xsd:restriction base="xsd:string"> | ||
| <xsd:enumeration value="all" /> | ||
| <xsd:enumeration value="get" /> | ||
| <xsd:enumeration value="set" /> | ||
| </xsd:restriction> | ||
| </xsd:simpleType> | ||
|
|
||
| <xsd:element name="type"> | ||
| <xsd:complexType> | ||
| <xsd:choice minOccurs="0" maxOccurs="unbounded"> | ||
| <xsd:element ref="event" /> | ||
| <xsd:element ref="method" /> | ||
| <xsd:element ref="attribute" /> | ||
| <xsd:element ref="field" /> | ||
| <xsd:element ref="property" /> | ||
| <xsd:element ref="type" /> | ||
| </xsd:choice> | ||
| <xsd:attribute name="fullname" type="xsd:string" /> | ||
| <xsd:attribute name="name" type="xsd:string" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we support
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The documentation has
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does the code do?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it also allows name on nested types but not on top level.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| <xsd:attribute name="required" type="xsd:boolean" /> | ||
| <xsd:attribute name="preserve" type="preservevalues" /> | ||
| <xsd:attribute name="feature" type="xsd:string" /> | ||
| <xsd:attribute name="featurevalue" type="xsd:boolean" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add |
||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| <xsd:element name="linker"> | ||
| <xsd:complexType> | ||
| <xsd:choice maxOccurs="unbounded" minOccurs="0"> | ||
| <xsd:element ref="assembly" /> | ||
| <xsd:element ref="type" /> | ||
| </xsd:choice> | ||
| </xsd:complexType> | ||
| </xsd:element> | ||
|
|
||
| </xsd:schema> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -356,7 +356,7 @@ static void AddXmlTypeNode (XmlDocument doc, XmlNode assemblyNode, string typeNa | |
| typeNode.Attributes.Append (preserve); | ||
| } else if ((members.fields == null) && (members.methods == null)) { | ||
| XmlAttribute preserve = doc.CreateAttribute ("preserve"); | ||
| preserve.Value = "nothing"; | ||
| preserve.Value = "none"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's correct to have only one between the two, but just be aware that seems like runtime is using the 'nothing' notation since is what it was documented. See file.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the guiding force should be what the linker actually recognizes - if it's both, then we should allow both in the schema as well.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like the code is looking for Nothing and if an invalid value is passed then it defaults to Nothing |
||
| typeNode.Attributes.Append (preserve); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.