Giter Site home page Giter Site logo

gxdoc's Introduction

gxdoc

evaluate golang on building up traceable document system

Web server configuration

  1. run gxdoc
  2. a config.ini file will be generated at same directory of gxdoc executable binary
  3. edit config.ini with any text editor

REST API

API Summary

HTTP Method URL Description
GET /api/document/schema-infos get all schema summary
POST /api/document/schema-infos register a new schema
GET /api/document/schema-infos/{schema-name} get specific schema summary
POST /api/document/schema-infos/{schema-name} update schema summary
GET /api/document/schemas/{schema-name} get latest schema definition
POST /api/document/schemas/{schema-name} update schema definition
GET /api/document/schemas/{schema-name}/revisions/{revision-number} get specific schema definition by revision number
GET /api/document/schemas/{schema-name}/draft get draft version of schema definition
POST /api/document/schemas/{schema-name}/draft update draft version of schema definition
POST /api/document/{schema-name}/validate validate data with XML or JSON format

Get list of Schema Infomation

NOTE: {dev-start-url} is defined in config.ini file

URL Pattern:

GET /api/document/schema-infos

Output:

{
    "response": [
        {
            "name": "pr",
            "latestRev": 1,
            "desc": "purchase requisite",
            "isActive": true,
            "hasDraft": true
        },
        {
            "name": "invoice",
            "latestRev": 3,
            "desc": "invoice....",
            "isActive": true,
            "hasDraft": false
        }
    ]
}

Get Schema Information By Schema Name

URL Pattern:

GET /api/document/schema-infos/{schema-name}

Output:

{
    "response": {
        "name": "pr",
        "latestRev": 1,
        "desc": "purchase requisite",
        "isActive": true,
        "hasDraft": true
    }
}

Register New Schema Information

URL Pattern:

POST /api/document/schema-infos

Input Data (sample):

{
    "name":"po",
    "desc":"purchase order"
}

Update Schema Information

URL Pattern:

POST /api/document/schema-infos/{schema-name}

Input Data (sample):

{
    "name":"po",
    "desc":"new PO description",
    "isActive": true
}

Get Latest Schema Definition

URL Pattern:

GET /api/document/schemas/{schema-name}

Output:

<?xml version="1.0"?>
<dxdoc name="invoice" revision="3" id="">
    <dxstr name="invNo"></dxstr>
    <dxint name="totalQty" isOptional="true"></dxint>
    <dxdecimal name="price" precision="2"></dxdecimal>
</dxdoc>

Get Schema Definition by Revision

URL Pattern:

GET /api/document/schemas/{schema-name}/revision/{revision-number}

Output:

<?xml version="1.0"?>
<dxdoc name="invoice" revision="2" id="">
    <dxstr name="invNo"></dxstr>
    <dxint name="totalQty" isOptional="true"></dxint>
    <dxdecimal name="price" precision="6"></dxdecimal>
</dxdoc>

Update Schema Definition

NOTE: newly update schema definition will register as new definition with higher revision number. previous definition will remain intact in database

URL Pattern:

POST /api/document/schemas/{schema-name}

Input Data (sample):

<?xml version="1.0"?>
<dxdoc name="invoice" revision="0" id="">
    <dxstr name="invNo"></dxstr>
    <dxint name="totalQty" isOptional="true"></dxint>
    <dxdecimal name="price" precision="2"></dxdecimal>
    <dxbool name="needAudit"></dxbool>
</dxdoc>

Get Schema Definition's Draft

URL Pattern:

GET /api/document/schemas/{schema-name}/draft

Output:

<?xml version="1.0"?>
<dxdoc name="invoice" revision="-1" id="">
    <dxstr name="invNo"></dxstr>
    <dxint name="totalQty" isOptional="true"></dxint>
    <dxdecimal name="price" precision="2"></dxdecimal>
</dxdoc>

Update Schema Definition's Draft

NOTE: newly posted schema definition will overwrite previous draft definition!

URL Pattern:

POST /api/document/schemas/{schema-name}/draft

Input Data (sample):

<?xml version="1.0"?>
<dxdoc name="invoice" revision="0" id="">
    <dxstr name="invNo"></dxstr>
    <dxint name="totalQty" isOptional="true"></dxint>
    <dxdecimal name="price" precision="2"></dxdecimal>
</dxdoc>

Validate Data with Targeted Schema

URL Pattern:

POST /api/document/{schema-name}/validate

Input Data (XML sample):

please set 'Content-Type' to 'text/xml'

<book>
    <name>Oliver's Travel</name>
    <author>John Doe</author>
</book>

Input Data (JSON sample):

please set 'Content-Type' to 'application/json'

{
    "name": "Oliver's Travel",
    "author": "John Doe"
}

Output:

{
    "response": {
        "isValid": true,
        "message": ""
    }
}

gxdoc's People

Contributors

guinso avatar

Watchers

 avatar  avatar

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.