swagger

WebApi && Swagger 及Swagger配置

耗尽温柔 提交于 2020-01-17 14:06:47
WebApi & Swagger Swagger 简介 Swashbuckle 是一个开源项目,为使用 ASP.NET Core MVC 构建的 Web APIs 生成 Swagger 文档。 Swagger 是一个机器可读的 RESTful API 表现层,它可以支持交互式文档、客户端 SDK 的生成和可被发现 Swashbuckle 有两个核心的组件 Swashbuckle 有两个核心的组件 Swashbuckle.SwaggerGen : 提供生成描述对象、方法、返回类型等的 JSON Swagger 文档的功能。 Swashbuckle.SwaggerUI : 是一个嵌入式版本的 Swagger UI 工具,使用 Swagger UI 强大的富文本表现形式来可定制化的来描述 Web API 的功能,并且包含内置的公共方法测试工具。 在 VS2017 中创建并使用 Swagger 1. 创建一个 WebApi 的 Asp.Net 应用程序 2. 使用 “ Nuget 包管理器”搜索“ Swashbuckle ”安装即可 3. 然后更改项目属性 “ Xml 文档文件” 4. 使用 Swagger :启动项目,然后在地址栏输入“ http://localhost:49245/swagger/ui/index#/Login ” 5.Swagger配置(后续更上) 来源: https

How to refer to an external JSON file containing response examples in Swagger?

一个人想着一个人 提交于 2020-01-17 06:26:09
问题 In my Swagger spec file, I want to return example responses, for that I can add examples in response. But that makes my spec file quite big and error prone. Is there a way to refer to a file containing JSON of an example object? I tried something like below but it doesn't seem to work. get: tags: - businesses summary: Get Taxable Entities details description: '' operationId: getTaxableEntities produces: - application/json parameters: - name: business_id in: path required: true type: integer

Swagger grails Integration

假如想象 提交于 2020-01-17 06:14:25
问题 I am new to swagger and I want to integrate swagger to Restful API project using grails framework. Please help if anybody have any idea what i am doing wrong? my grails specification as below: | Grails Version: 3.0.7 | Groovy Version: 2.4.4 | JVM Version: 1.8.0_71 Did some settings for swagger as below: in build.gradle: dependencies { ... compile "io.swagger:swagger-core:1.5.3" compile "io.swagger:swagger-jaxrs:1.5.3" ... } in resources.groovy import io.swagger.jaxrs.config.BeanConfig beans =

Guide to use Restlet Swagger extension for GAE

你。 提交于 2020-01-17 04:23:08
问题 I tried to do a similar approach: public Restlet createInboundRoot() { Router apiRouter = createApiRouter(); attachSwaggerSpecificationRestlet(apiRouter, "/api-docs"); return apiRouter; } When /api-docs is access Restlet throws Error 404, what could be messing. The idea is that the apiRouter we have is fully working at this state, when we acess resource like /stuff etc. What could be missing in this code? Or is there any specific notes to take into consideration when using Restlet Swagger

spring boot 整合swagger

时光总嘲笑我的痴心妄想 提交于 2020-01-17 01:48:56
简介: Swagger 是一个规范和完整的框架,用于生成、描述、调用和可视化 RESTful 风格的 Web 服务。总体目标是使客户端和文件系统作为服务器以同样的速度来更新。 作用: 接口的文档在线自动生成。 功能测试。 pom.xml <!-- Swagger --> < dependency > < groupId > io.springfox </ groupId > < artifactId > springfox-swagger2 </ artifactId > < version > 2.9.2 </ version > </ dependency > < dependency > < groupId > io.springfox </ groupId > < artifactId > springfox-swagger-ui </ artifactId > < version > 2.9.2 </ version > </ dependency > 启动类 类上添加 @EnableSwagger2 注释 Controller 添加 @Api(value = “前端控制器”) 和 @ApiOperation(value = “文件上传”, notes = “文件上传”) 注解 访问 http://localhost:8080/swagger-ui.html

swagger2 使用

元气小坏坏 提交于 2020-01-16 22:47:34
swagger2 使用 swagger2 使用 springboot2.0 + swagger2 的使用,可以说把rest接口的文档梳理的更规范,也更便捷和更易维护了 swagger2 使用 对于配置文件的参数,我们习惯于配置到yanl 文件中 ronghe : # Swagger相关配置 swagger : basePackage : com.longchuang.ronghe title : xxx description : xxxxx. version : 2.0 author : sisyphus url : https : //xxx email : xxxx@qq.com license : Apache 2.0 licenseUrl : https : //www.apache.org/licenses/LICENSE - 2.0.html @Data public class SwaggerProperties { private String basePackage ; private String title ; private String description ; private String version ; private String author ; private String url ; private String email ;

Swagger注释详细说明

邮差的信 提交于 2020-01-16 16:34:45
API说明 在Java后端中,总共有以下API注释类型。 作用范围 API 使用位置 对象属性 @ApiModelProperty 用在出入参数对象的字段上 协议集描述 @API 用于在controller类上 协议描述 @ApiOperation 用在controller的方法上 response集 @ApiResponses 用在controller的方法上 response @ApiResponse 用在@ApiResponses里边 非对象参数集 @ApiImplicitParams 用在controller的方法上 非对象参数描述 @ApiImplicitParam 用在@ApiImplicitParams的方法里边 描述返回对象的意义 @ApiModel 用在返回对象类上 @RequestMapping这个注解只推荐使用三种配置:value , method , produces 。 @ ApiOperation ( "信息软删除" ) @ ApiResponses ( { @ ApiResponse ( code = CommonStatus . OK , message = "操作成功" ) , @ ApiResponse ( code = CommonStatus . EXCEPTION , message = "服务器内部异常" ) , @

Nestjs

时光总嘲笑我的痴心妄想 提交于 2020-01-16 14:45:59
Nestjs for TypeScript https://docs.nestjs.com/ CLI # 全局安装CLI npm i -g @nestjs/cli # 创建项目 nest new project-name # 运行(watch模式) npm run start:dev # 创建子项目 nest g app xxx # nest g app admin 会生成一个apps文件夹,下面有admin和server文件夹 # 创建公共模块 nest g lib db # 启动子项目路 nest start -w admin # 创建子模块(一个空的文件夹) nest g mo child-module nest g mo -p admin users # 创建生成XxController nest g co xx nest g co -p admin users npm i --save @nestjs/swagger swagger-ui-express npm i mongoose @types/mongoose nestjs-typegoose @typegoose/typegoose Swagger npm i --save @nestjs/swagger swagger-ui-express ... import { SwaggerModule,

springboot整合Swagger2弹窗提示Unable to infer base url. This is common when using dynamic servlet registra

匆匆过客 提交于 2020-01-16 13:24:23
错误信息: Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually 访问swagger-ui.html弹窗 根据错误信息在网上找了说是加上@EnableSwagger2注解的但是这个注解我是有的 @Configuration @EnableSwagger2 public class Swagger2 { @Bean public Docket createRestApi ( ) { return new Docket ( DocumentationType.SWAGGER_2 ) .apiInfo ( apiInfo ( )) .select ( )