Giter Club home page Giter Club logo

swaggertoschema's Introduction

SwaggerToSchema

Use your swagger URL or a local file and create to LAC Schema file which can be used to POST and create data models.

##Clone this repository to a directory on your system.

git clone https://github.com/tylerm007/SwaggerToSchema.git ~/SwaggerToSchema

Change directory.

cd ~/SwaggerToSchema

##Install this package

mvn install

##To Run pass an argument for a swagger file or an http location

###Use a URL endpoint

sh genSchema.sh http://petstore.swagger.io/v2/swagger.json

###Pass a file in Swagger 2.0 format

sh genSchema.sh uber.json

###save the output to a file

sh genSchema.sh uber.json uberSchemaModel.json

###Schema output The output is a format can used by CA Live API Creator to create a new database model. Each object will be mapped as an entity, columns, keys, parents (relationships). The Schema can be manually modified before posting to Live API Creator.

 [ {
  "entity" : "Order",
  "primaryKeyColumns" : [ "ident" ],
  "columns" : [ {
    "name" : "ident",
    "generic_type" : "number",
    "subtype" : "integer",
    "nullable" : false,
    "autonum" : true
  }, {
    "name" : "id",
    "generic_type" : "number",
    "subtype" : "integer",
    "nullable" : true
  }, {
    "name" : "petId",
    "generic_type" : "number",
    "subtype" : "integer",
    "nullable" : true
  }, {
    "name" : "quantity",
    "generic_type" : "number",
    "subtype" : "integer",
    "nullable" : true
  }, {
    "name" : "shipDate",
    "generic_type" : "datetime",
    "nullable" : true
  }, {
    "name" : "status",
    "generic_type" : "string",
    "size" : 20,
    "nullable" : true
  }, {
    "name" : "complete",
    "generic_type" : "boolean",
    "nullable" : true
  } ],
  "parents" : [ ],
  "keys" : [ {
    "name" : "PRIMARY",
    "type" : "primary",
    "columns" : [ "ident" ]
  } ]
}....truncated

]

##Command Line Schema Creation The output is in CA Live API Creator @schema format - this can be used to create a new data model using the Live API Creator admin command line utility (NodeJS) - you can get a list of project idents (lacadmin project list) and you need to have a prefix of a managed data source (e.g. schema is editable) - (lacadmin datasource list).

lacadmin login -u [adminuser] -p [password] http://localhost:8080 -a schema
lacadmin use schema
lacadmin schema create --prefix [prefix] --project_ident [ident] --file uberSchemaModel.json

swaggertoschema's People

Contributors

tylerband avatar tylerm007 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.