定制 bernardosecades/split-blue 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bernardosecades/split-blue

Composer 安装命令:

composer create-project bernardosecades/split-blue

包简介

Split Blueprint files (request/response sections) to generate documentation and mock servers files

README 文档

README

Build Status Scrutinizer Code Quality SensioLabsInsight

API Blueprint renderer.

You can split your API blueprint document with request/response (text-plain, json, xml ...) files and include in your main document to easily maintenance.

If you need load mock server with these API blueprint documents you can process them to render all content in unique file (including content request/response files) and load this file in mock server like drakov or similar.

The html documentation will be generated from that unique file.

Installation

This tool use markdown-pp and aglio to include request/response files in API blueprint documents and generate html documentation.

You can execute shell script to install MarkdownPP and Aglio:

./install.sh

Or install step by step next commands:

Install markdown-pp

pip install MarkdownPP

Install aglio

npm install -g aglio

Install some dependencies with composer

composer install

Usage

Example apib file:

+ Request OK (application/json;charset=UTF-8)

    + Body

            {
                "checkIn": "YYY-mm-dd",
                "checkOut": "YYY-mm-dd",
                "occupancy": "A",
                "hotelCode": "A",
                "locationCode": "A"
            }

+ Response 200 (application/xml;charset=UTF-8)

    + Body

<!-- include markdown-pp (without spaces before) -->
!INCLUDE "Response/a.xml"

Where file Response\a.xml will have:

<csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw" xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:dct="http://www.purl.org/dc/terms/" xsi:schemaLocation="http://www.opengis.net/cat/csw http://localhost:8888/SpatialWS-SpatialWS-context-root/cswservlet?recordTypeId=1 " version="2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <csw:RequestId>4</csw:RequestId>
   <csw:SearchStatus status="complete"/>
   <csw:SearchResults recordSchema="http://www.opengis.net/cat/csw" numberOfRecordsMatched="1" numberOfRecordsReturned="1" nextRecord="0" expires="2007-02-09T16:32:35.29Z">
      <csw:Record xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:ows="http://www.opengis.net/ows" xmlns:dct="http://www.purl.org/dc/terms/">
         <dc:contributor xmlns:dc="http://www.purl.org/dc/elements/1.1/" scheme="http://www.example.com">Raja</dc:contributor>
         <dc:identifier xmlns:dc="http://www.purl.org/dc/elements/1.1/">REC-1</dc:identifier>
      </csw:Record>
   </csw:SearchResults>
</csw:GetRecordsResponse>

If you execute command ``./bin/split-blue c` from this tool you will generate two files:

  • Build/out.apib (with content of a.xml file)
  • Build/out.html (documentation html of your API with content a.xml file)

The content of file Build/out.apib will be:

+ Request OK (application/json;charset=UTF-8)

    + Body

            {
                "checkIn": "YYY-mm-dd",
                "checkOut": "YYY-mm-dd",
                "occupancy": "A",
                "hotelCode": "A",
                "locationCode": "A"
            }

+ Response 200 (application/xml;charset=UTF-8)

    + Body

<!-- include markdown-pp (without spaces before) -->
<csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw" xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:dct="http://www.purl.org/dc/terms/" xsi:schemaLocation="http://www.opengis.net/cat/csw http://localhost:8888/SpatialWS-SpatialWS-context-root/cswservlet?recordTypeId=1 " version="2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <csw:RequestId>4</csw:RequestId>
   <csw:SearchStatus status="complete"/>
   <csw:SearchResults recordSchema="http://www.opengis.net/cat/csw" numberOfRecordsMatched="1" numberOfRecordsReturned="1" nextRecord="0" expires="2007-02-09T16:32:35.29Z">
      <csw:Record xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:ows="http://www.opengis.net/ows" xmlns:dct="http://www.purl.org/dc/terms/">
         <dc:contributor xmlns:dc="http://www.purl.org/dc/elements/1.1/" scheme="http://www.example.com">Raja</dc:contributor>
         <dc:identifier xmlns:dc="http://www.purl.org/dc/elements/1.1/">REC-1</dc:identifier>
      </csw:Record>
   </csw:SearchResults>
</csw:GetRecordsResponse>

It will be ready to load in your mock server.

Generate HTML Documentation and files to load in Mock Server

./bin/split-blue c <path>

Example 1:

./bin/split-blue c md

It will try to search all files named like index.apib to process include sentences of that file and generate output files (out.apib and out.html) in folder Build, if this not exist it will create it in the same level that index.apib file

Example content index.apib:

!INCLUDE "../cancel-api.apib"
!INCLUDE "../valuate-api.apib"

So this command will generate files:

  • md/example/MyAPI/V1/Compile/Build/out.apib
  • md/example/MyAPI/V1/Compile/Build/out.html
  • md/example/MyAPI/V2/Compile/Build/out.apib
  • md/example/MyAPI/V2/Compile/Build/out.html

Example 2:

./bin/split-blue c md/example/MyAPI/V2
  • md/example/MyAPI/V2/Compile/Build/out.apib
  • md/example/MyAPI/V2/Compile/Build/out.html

It will generate files:

Tests

You can execute integration tests with next command:

vendor/bin/phpunit

Screenshots

./bin/split-blue c md/example/MyAPI/V2

Command with argument

统计信息

  • 总下载量: 25.28k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固