GithubHelp home page GithubHelp logo

preja / swagger2doc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openconnectivityfoundation/swagger2doc

0.0 0.0 0.0 385 KB

Swagger2.0 to word document conversion tool

License: Other

Python 80.21% Shell 12.89% JavaScript 6.90%

swagger2doc's Introduction

swagger2doc

swagger2doc tool

description

This tool creates the documentation for an OCF resource in a supplied word document.

The tools needs to be called for each resource that needs to be added to the word document.

installation

This tool is python3 based.

install with curl https://openconnectivityfoundation.github.io/swagger2doc/install.sh | bash

which executes the following steps:

  • clone git repo
  • execute the install script for python 3.5 dependencies (located in the src folder) with python3.5 :
    • pip3 install -r requirements-3.5.txt and use the tool relative of where the respository is located on your system.

usage (resources)

from the src directory:

python3 swagger2doc.py <options> use -h to see all the options.

usage: swagger2doc.py [-h] [-ver] [-swagger [SWAGGER]] [-schema [SCHEMA]]
                      [-docx [DOCX]] [-word_out [WORD_OUT]]
                      [-resource [RESOURCE]] [-schemadir [SCHEMADIR]]
                      [-derived DERIVED] [-annex ANNEX]

optional arguments:
  -h, --help            show this help message and exit
  -ver, --verbose       Execute in verbose mode
  -swagger [SWAGGER], --swagger [SWAGGER]
                        swagger file name
  -schema [SCHEMA], --schema [SCHEMA]
                        schema to be added to word document
  -docx [DOCX], --docx [DOCX]
                        word file in
  -word_out [WORD_OUT], --word_out [WORD_OUT]
                        word file out
  -resource [RESOURCE], --resource [RESOURCE]
                        resource (path) to be put in the word document
  -schemadir [SCHEMADIR], --schemadir [SCHEMADIR]
                        path to dir with additional referenced schemas
  -derived DERIVED, --derived DERIVED
                        derived data model specificaton (--derived XXX) e.g.
                        XXX Property Name in table use "." to ignore the
                        property name setting
  -annex ANNEX, --annex ANNEX
                        uses a annex heading instead of normal heading
                        (--annex true)

usage derived models

see https://github.com/openconnectivityfoundation/swagger2doc/blob/master/derived_model.md

enhancements

1.0.1 :

  • added caption to table.
  • text description of resources is now left alligned.
  • added read-write when readOnly is not available on property.
  • 4th column in property overview is now left alligned.

swag-validator

Tool to validate the x-example against the supplied schema. The x-example can occur:

  • in the body of an put/post/patch
  • as example of a reponse code

NOTE: some restrictions on the swagger input:

  • schema is a reference to a definition
  • the definition must be in the same file and does not have other references.

good practice:

  • each payload definition needs to have:
    • schema
    • x-example

The validation is done by means of json schema (draft 4) validation.

usage

from the src directory:

python3 swag-validator.py <options> use -h to see all the options.

swagger2doc's People

Contributors

marktrayer avatar wavdbeek 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.