定制 nicofuma/swagger-bundle 二次开发

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

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

nicofuma/swagger-bundle

最新稳定版本:1.0.7

Composer 安装命令:

composer require nicofuma/swagger-bundle

包简介

A bundle integrating swagger to validate Requests and Responses

README 文档

README

Latest Stable Version Latest Unstable Version License Travis Build Status SensioLabsInsight Scrutinizer Code Quality Code Coverage

Description

This bundle integrates Swagger in Symfony.

Currently, it supports the following features:

  • Automatic validation of all incoming requests based on the Swagger definition (including headers and query string)
  • Configuring multiple API with different swagger files using configuration
  • FOSRestBundle integration: automatic configuration of the ParamFetcher
  • Behat integration: context to validate the response

Installation

Add the required package using composer.

Stable version

composer require nicofuma/swagger-bundle:^1.0

Bleeding-edge version

composer require nicofuma/swagger-bundle:@dev

Enabling the bundle

Add the bundle to your AppKernel.

// in %kernel.root_dir%/AppKernel.php
$bundles = array(
    // ...
    new Nicofuma\SwaggerBundle\NicofumaSwaggerBundle(),
    // ...
);

Configuration

nicofuma_swagger:
    definition:
        pattern: '/api/v1'
        swagger_file: swagger/swagger.json
        strict: true

pattern any url matching this pattern will be tested against the swagger_file swagger_file swagger file to use for this API. Can be either an bsolute path, a path relative to %kernel.root_dir%/Resources/ or a bundle resource @MyBundle/Dir/swagger.json strict whether or not an exception must be thrown if the path does not match any definition in the swagger file

Configuration reference

# Default configuration for extension with alias: "swagger"
nicofuma_swagger:
    definitions:
        -
            pattern:
                # use the urldecoded format
                path:                 ^/api/public/
                host:                 null
                ips:                  []
                methods:              []
            swagger_file:         swagger-public.json
            strict:               true
        -
            pattern:
                # use the urldecoded format
                path:                 ^/api/private/
                host:                 null
                ips:                  []
                methods:              []
            swagger_file:         swagger-private.json
            strict:               true

Behat integration

Add the following context in your behat.yml file

- Nicofuma\SwaggerBundle\Tests\Behat\Context\SwaggerContext: {map: '@swagger.validator_map'}

Contributing

NicofumaSwaggerBundle is an open source project. If you'd like to contribute, please do.

License

This library is under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固