Giter VIP home page Giter VIP logo

schemavore's People

Stargazers

 avatar  avatar

Watchers

 avatar

schemavore's Issues

Add support for generating XSD documents using simple types

Stand alone XSDs should be composed of simple/primitive elements. These should be able to construct themselves by interrogating the elements they contain. Also, rendering should respect the order the elements were declared in. A possible api could be something like the following:

class SimpleDocument(Document):
    first_name = String("firstName")
    last_name = String("LastName")

sd = MySimpleDocument()
sd.first_name = "Joe"
sd.last_name = "Smith"

xml = sd.xml_document
xsd = sd.xsd_document

The other implication of this is that value needs to yanked out of the constructor of the document....and that the setter method must properly validate the data at the model level before it hits the renders.

setup.py

Get the setup.py cleaned up and working properly. Implement a test runner/suite to run all tests with python setup.py test.

sketch out implemtation for reusable 'types' in the schema nodes

Rework or consider an additional abstraction to support element type declarations in a XSD.
The goal, when declaring a type in a XSD is to produce the equivalent of the following.

    <xs:element name="car" type="carType"/>

    <xs:simpleType name="carType">
      <xs:restriction base="xs:string">
        <xs:enumeration value="Audi"/>
        <xs:enumeration value="Golf"/>
        <xs:enumeration value="BMW"/>
      </xs:restriction>
    </xs:simpleType>

The current implementation produces only the following.

<xs:element name="car">
   <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Audi"/>
      <xs:enumeration value="Golf"/>
      <xs:enumeration value="BMW"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element> 

Simplify type declarations in the xsd_nodes

Currently in simple elements where there are restriction the node is rendered thus:

    <xs:element name="s2" type="xs:string">
        <xs:simpleType>
             <xs:restriction base="xs:string">
                 <xs:minLength value="4"/>
                 <xs:maxLength value="6"/>
             </xs:restriction>
         </xs:simpleType>
     </xs:element>

The type="..." in the element name node is not required since it is present in the restriction node. So, it can be simplified as:

    <xs:element name="s2">
            <xs:simpleType>
                 <xs:restriction base="xs:string">
                     <xs:minLength value="4"/>
                     <xs:maxLength value="6"/>
                 </xs:restriction>
          </xs:simpleType>
     </xs:element>

Docs......

Get the API documented. And write a readme.

Add attributes

schemavore needs to support xml/xsd attributes. Implementing them should be relativity simple. Also, the XML primitive types must support wrapping and rendering the attributes correctly.

element names should use the attribute name in a document unless an option is supplied.

Consider making the element name parameter optional....

This works with a container document in mid...so

class MyDocument(DocumentBase):
    a = String()
    b = String().name = "aname"
    # or 
    c = String(name="aname")

So the xsd should render something like the following

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="a" type="xs:string"/>
    <xs:element name="aname" type="xs:string"/>

The problem becomes rendering this properly using schma_node descriptor as it exists today.....It need to have a way of determining the name.

XSD Elements not rendering in proper order

Currently the XSD document is not rendering elements in the order that they are declared in the Document. This is not really an issue with a document composed of only simple elements but.........when I get to complex types in a sequence it will be necessary to respect sequence ordering. So, start now and not deal with the pain of adding it later

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.