[ 
https://issues.apache.org/jira/browse/THRIFT-3523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15090035#comment-15090035
 ] 

ASF GitHub Bot commented on THRIFT-3523:
----------------------------------------

Github user Jens-G commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/774#discussion_r49244531
  
    --- Diff: lib/xml/thrift-idl.xsd ---
    @@ -0,0 +1,265 @@
    +<?xml version="1.0" encoding="UTF-8"?>
    +<schema xmlns="http://www.w3.org/2001/XMLSchema";
    +        targetNamespace="http://thrift.apache.org/xml/idl"; 
    +        xmlns:tns="http://thrift.apache.org/xml/idl"; 
    +        elementFormDefault="qualified">
    +
    +  <element name="idl" type="tns:IDL" />
    +  <element name="document" type="tns:Document" />
    +
    +  <complexType name="IDL">
    +    <sequence>
    +      <element ref="tns:document" minOccurs="1" maxOccurs="unbounded"/>
    +    </sequence>
    +  </complexType>
    +
    +  <complexType name="Document">
    +    <sequence>
    +      <choice minOccurs="0" maxOccurs="unbounded">
    +        <element name="include" type="tns:Include" />
    +        <element name="namespace" type="tns:Namespace" />
    +      </choice>
    +      <choice minOccurs="0" maxOccurs="unbounded">
    +        <element name="exception" type="tns:Exception" />
    +        <element name="typedef" type="tns:Typedef" />
    +        <element name="service" type="tns:Service" />
    +        <element name="struct" type="tns:Struct" />
    +        <element name="const" type="tns:Const" />
    +        <element name="union" type="tns:Union" />
    +        <element name="enum" type="tns:Enum" />
    +      </choice>
    +    </sequence>
    +    <attribute name="name" type="string" />
    +    <attribute name="targetNamespace" type="anyURI" />
    +    <attribute name="doc" type="string" />
    +  </complexType>
    +
    +  <complexType name="Include">
    +    <attribute name="file" type="string" />
    +    <attribute name="name" type="string" />
    +  </complexType>
    +
    +  <complexType name="Namespace">
    +    <sequence>
    +      <element name="annotation" type="tns:Annotation" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +    </sequence>
    +    <attribute name="name" type="string" />
    +    <attribute name="value" type="string" />
    +    <attribute name="doc" type="string" />
    +  </complexType>
    +
    +  <group name="AbstractStruct">
    +    <sequence>
    +      <element name="field" type="tns:Field" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +      <element name="annotation" type="tns:Annotation" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +    </sequence>
    +  </group>
    +
    +  <attributeGroup name="StructAttributes">
    +    <attribute name="name" type="string" />
    +    <attribute name="doc" type="string" />
    +  </attributeGroup>
    +
    +  <complexType name="Exception">
    +    <group ref="tns:AbstractStruct" />
    +    <attributeGroup ref="tns:StructAttributes" />
    +  </complexType>
    +
    +  <complexType name="Service">
    +    <sequence>
    +      <element name="method" type="tns:Method" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +      <element name="annotation" type="tns:Annotation" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +    </sequence>
    +    <attribute name="name" type="string" use="required" />
    +    <attribute name="targetNamespace" type="string" use="required" />
    +    <attribute name="parent-module" type="string" use="optional" />
    +    <attribute name="parent-id" type="string" use="optional" /> 
    +    <attribute name="doc" type="string" />
    +  </complexType>
    +
    +  <complexType name="Method">
    +    <sequence>
    +      <element name="returns" type="tns:ThriftType" />
    +      <element name="arg" type="tns:Field" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +      <element name="throws" type="tns:Field" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +      <element name="annotation" type="tns:Annotation" 
    +               minOccurs="0" maxOccurs="unbounded" />
    +    </sequence>
    +    <attribute name="name" type="string" use="required" />
    +    <attribute name="oneway" type="boolean" />
    +    <attribute name="doc" type="string" />
    +  </complexType>
    +
    +  <complexType name="Typedef">
    +    <complexContent>
    +      <extension base="tns:ThriftType">
    +        <sequence>
    +          <element name="annotation" type="tns:Annotation" 
    +                   minOccurs="0" maxOccurs="unbounded" />
    +        </sequence>
    +        <attribute name="name" type="string" use="required" />
    +        <attribute name="doc" type="string" />
    +      </extension>
    +    </complexContent>
    +  </complexType>
    +
    +  <complexType name="Struct">
    +    <group ref="tns:AbstractStruct" />
    +    <attributeGroup ref="tns:StructAttributes" />
    +  </complexType>
    +
    +  <complexType name="Union">
    +    <group ref="tns:AbstractStruct" />
    +    <attributeGroup ref="tns:StructAttributes" />
    +  </complexType>
    +
    +  <complexType name="Enum">
    +    <sequence>
    +      <element name="member" minOccurs="1" maxOccurs="unbounded">
    +        <complexType>
    +          <sequence>
    +            <element name="annotation" type="tns:Annotation" 
    +                     minOccurs="0" maxOccurs="unbounded" />
    +          </sequence>
    +          <attribute name="name" type="string" use="required" />
    +          <attribute name="value" type="int" />
    +          <attribute name="explicit" type="boolean" />
    +          <attribute name="doc" type="string" />
    +        </complexType>
    +      </element>
    +      <element name="annotation" type="tns:Annotation" 
    +                minOccurs="0" maxOccurs="unbounded" />
    +    </sequence>
    +    <attribute name="name" type="string" use="required" />
    +    <attribute name="doc" type="string" />
    +  </complexType>
    +
    +  <complexType name="Field">
    +    <complexContent>
    +      <extension base="tns:ThriftType">
    +        <sequence>
    +          <element name="default" minOccurs="0" maxOccurs="1">
    +            <complexType>
    +              <group ref="tns:ConstValue" />
    +            </complexType>
    +          </element>
    +          <element name="annotation" type="tns:Annotation" 
    +                   minOccurs="0" maxOccurs="unbounded" />
    +        </sequence>
    +        <attribute name="field-id" type="long" />
    +        <attribute name="name" type="string" use="required" />
    +        <attribute name="required" type="tns:Requiredness" />
    +        <attribute name="doc" type="string" />
    +      </extension>
    +    </complexContent>
    +  </complexType>
    +
    +  <simpleType name="Requiredness">
    +    <restriction base="string">
    +      <enumeration value="required" />
    +      <enumeration value="optional" />
    +    </restriction>
    --- End diff --
    
    Ok, I did not read it correctly. The attribute is of course optional by 
default, and that's perfectly fine.


> XML Generator
> -------------
>
>                 Key: THRIFT-3523
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3523
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Compiler (General)
>            Reporter: Benjamin Gould
>            Assignee: Benjamin Gould
>            Priority: Minor
>
> I've put together an XML model for Thrift IDL that is very similar in concept 
> and structure to the model created by the JSON generator of the Thrift 
> compiler.  The code is based on the JSON generator, and inherits the 'merge' 
> option from that module for including the model of all includes in a single 
> file if desired.
> This generator is useful if you wish to extend the Thrift compiler with some 
> XML based templating engine such as XSLT.  For example I have prototyped 
> transforms that can create valid XML schema and WSDL files from Thrift IDL, 
> as well as transform SOAP requests and responses to and from Thrift messages. 
>  Those transforms are not included because they may be outside the scope of 
> Thrift, but I can provide them if interested.  Regardless, I feel the XML 
> model is generally useful and might be a good addition to the Thrift compiler.
> Also included is an XML schema for the model file format and tests that 
> generate XML from existing IDL in the Thrift test suite to validate against 
> that schema.  These tests are Ant based and so only run when --with-java is 
> enabled in ./configure



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to