承接 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

bernardosecades/split-blue 适用场景与选型建议

bernardosecades/split-blue 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 25.28k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bernardosecades/split-blue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bernardosecades/split-blue 我们能提供哪些服务?
定制开发 / 二次开发

基于 bernardosecades/split-blue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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