All Projects → Sayi → Swagger Dubbo

Sayi / Swagger Dubbo

Licence: apache-2.0
📃 Dubbo的Swagger服务文档

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Swagger Dubbo

Eshop Soa
EShop基于Dubbo实现SOA服务化拆分,并基于RocketMQ解决了分布式事务(新版SpringBootSOASkeleton)
Stars: ✭ 65 (-77.51%)
Mutual labels:  swagger, dubbo
Springbootexamples
Spring Boot 学习教程
Stars: ✭ 794 (+174.74%)
Mutual labels:  swagger, dubbo
Springboot
SpringBoot 整合各类框架和应用
Stars: ✭ 54 (-81.31%)
Mutual labels:  swagger, dubbo
Springboot Templates
springboot和dubbo、netty的集成,redis mongodb的nosql模板, kafka rocketmq rabbit的MQ模板, solr solrcloud elasticsearch查询引擎
Stars: ✭ 100 (-65.4%)
Mutual labels:  swagger, dubbo
Spring Boot Quick
🌿 基于springboot的快速学习示例,整合自己遇到的开源框架,如:rabbitmq(延迟队列)、Kafka、jpa、redies、oauth2、swagger、jsp、docker、spring-batch、异常处理、日志输出、多模块开发、多环境打包、缓存cache、爬虫、jwt、GraphQL、dubbo、zookeeper和Async等等📌
Stars: ✭ 1,819 (+529.41%)
Mutual labels:  swagger, dubbo
Bus
Bus 是一个基础框架、服务套件,它基于Java8编写,参考、借鉴了大量已有框架、组件的设计,可以作为后端服务的开发基础中间件。代码简洁,架构清晰,非常适合学习使用。
Stars: ✭ 253 (-12.46%)
Mutual labels:  swagger, dubbo
Tropical Fish
Pragmatic 风格的 Java EE 后端开发脚手架,开箱即用。基于 SpringBoot,技术选型采用主流的框架(Mybatis-Plus,Redisson,Xxl-job,Swagger)。项目特点:自定义查询语法, 可以自由组装查询条件查询数据,配合代码生成模块,提高研发效率;自定义 service 方法级别的文档生成规则,在业务方法增加必要的注解,可生成方法调用树,快速把握复杂代码业务逻辑。
Stars: ✭ 142 (-50.87%)
Mutual labels:  swagger, dubbo
JavaEE-projects
存放一些自己写的还有从不同开源社区fork下来的JavaEE项目,其中就不乏一些很多企业单位都在用的源码。
Stars: ✭ 43 (-85.12%)
Mutual labels:  swagger, dubbo
django rest framework swagger tutorial
django rest framework swagger tutorial
Stars: ✭ 20 (-93.08%)
Mutual labels:  swagger
Spring Petclinic Rest
REST version of the Spring Petclinic sample application
Stars: ✭ 257 (-11.07%)
Mutual labels:  swagger
full-stack-flask-couchdb
Full stack, modern web application generator. Using Flask, CouchDB as database, Docker, Swagger, automatic HTTPS and more.
Stars: ✭ 28 (-90.31%)
Mutual labels:  swagger
5gc apis
RESTful APIs of main Network Functions in the 3GPP 5G Core Network
Stars: ✭ 253 (-12.46%)
Mutual labels:  swagger
Nestjs Boilerplate
NestJS Boilerplate 😻(Authentication, TypeORM, Configuration, Swagger)
Stars: ✭ 267 (-7.61%)
Mutual labels:  swagger
AspNet5GeoElasticsearch
ASP.NET Core MVC Geo Elasticsearch Swashbuckle Swagger
Stars: ✭ 38 (-86.85%)
Mutual labels:  swagger
Swaggerlume
Lumen swagger
Stars: ✭ 277 (-4.15%)
Mutual labels:  swagger
json-ref-resolver
[Deprecated] Recursively resolve JSON pointers and remote authorities.
Stars: ✭ 27 (-90.66%)
Mutual labels:  swagger
SSM-DUBBO-HTTP
💥 dubbo provide HTTP service
Stars: ✭ 27 (-90.66%)
Mutual labels:  dubbo
Dubbo Go
Go Implementation For Apache Dubbo
Stars: ✭ 3,710 (+1183.74%)
Mutual labels:  dubbo
Swashbuckle.aspnetcore.filters
A bunch of useful filters for Swashbuckle.AspNetCore
Stars: ✭ 274 (-5.19%)
Mutual labels:  swagger
Openapi.tools
A collection of Editors, Linters, Parsers, Code Generators, Documentation, Testing
Stars: ✭ 257 (-11.07%)
Mutual labels:  swagger

Dubbo的Swagger服务文档(鉴于原分支版本过老存在的问题,本分支进行了新版本dubbo的适配)

公告:🎈 🎈 🎈 🌱 🌱 🌱

随着dubbo的蓬勃发展,个人对这个项目又有了一点新的期待和想法(功能和架构上),目前开通了群聊频道,欢迎加入讨论:加入Gitter群

image

  • swagger-dubbo起一个解析Swagger和收集文档的作用
  • dubbo-swagger-doc是一个web应用,从注册中心获取所有文档,是一个dubbo接口的swagger文档
  • dubbo-static-doc是一个dubbo接口的静态文档
  • dubbo-apidoc是一个dubbo接口的javaAPI文档

swagger-dubbo

Build Status jdk1.6+ dubbo2.6.0+

Dubbo |ˈdʌbəʊ| 是阿里巴巴提供的分布式框架,提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案。
Swagger围绕着OpenAPI规范,提供了一套设计、构建、文档化rest api的开源工具。

swagger-dubbo的核心价值是swagger式的文档化+rest风格的HTTP模拟测试。

  • 通过swagger阅读接口文档
  • 开发人员可以用它来自测服务接口,也可以用它来模拟别人的服务接口返回值
  • 测试可以用它来验证接口的正确性,基于HTTP进行接口测试

swagger-dubbo从某些方面提高了内部开发测试的效率,注意的是,rest服务不适合对外(前端)提供,务必在服务端或者测试内部使用

版本和计划

swagger-dubbo版本 支持dubbo版本号 支持dubbo注解 SpringMVC demo SpringBoot demo
1.1.0 移步老版本文档分支 dubbo2.5.3 ✅ 有
2.0.1 dubbo2.6.0+ ✅ 是 ✅ 有,示例文档 ✅ 有,示例文档
2.0.1_update apache版本dubbo ✅ 是 ✅ 有,示例文档 ✅ 有,示例文档

更新日志参见Release Page

Maven

<dependency>
  <groupId>com.deepoove</groupId>
  <artifactId>swagger-dubbo</artifactId>
  <version>2.0.1</version>
</dependency>

两步集成

一. 使用注解 @EnableDubboSwagger开启dubbo的swagger文档。

package com.deepoove.swagger.dubbo.example;

import org.springframework.context.annotation.Configuration;
import com.deepoove.swagger.dubbo.annotations.EnableDubboSwagger;

@Configuration
@EnableDubboSwagger
public class SwaggerDubboConfig {

}

二. 在spring的*-servlet.xml配置中,开启属性占位符的配置,开启Configuration注解,声明SwaggerDubboConfig。

<context:annotation-config />
<bean class="com.deepoove.swagger.dubbo.example.SwaggerDubboConfig" />
<context:property-placeholder />

集成已经完毕,启动web容器,浏览器访问 http://ip:port/context/swagger-dubbo/api-docs查看文档。

{
  "swagger": "2.0",
  "info": {
    "version": "1.0",
    "title": "dubbo-example-app",
    "contact": {
      "name": "Sayi"
    }
  },
  "basePath": "/dubbo-provider",
  "paths": {
    "/h/com.deepoove.swagger.dubbo.example.api.service.UserService/get": {
      "get": {
        "tags": [
          "UserService"
        ],
        "summary": "获取用户",
        "description": "User get(java.lang.String)通过id取用户信息",
        "operationId": "get",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "用户id",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "User": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "description": "用户姓名"
        },
        "site": {
          "type": "string"
        }
      }
    }
  }
}

swagger-ui查看文档

可以在任何能托管页面的容器内集成swagger-ui,配置swagger-dubbo提供的http://ip:port/context/swagger-dubbo/api-docs,可能需要跨域支持,详情参见官方文档 swagger-ui

@JKTerrific 在swagger-ui基础上开发了swagger-dubbo-ui, 解决了页面上的一些展示问题:

  • 参数为model时,输入框变更为输入域,并且支持JSON可视化
  • Model字段为date、byte时,支持展示具体类型,而不是string

配置

swagger-dubbo默认无需任何配置,但是也提供了一些可选项。

新增文件swagger-dubbo.properties,加载配置文件。

<context:property-placeholder location="classpath*:swagger-dubbo.properties" />

配置项说明:

#http请求地址,默认为http://ip:port/h/com.XXX.XxService/method
swagger.dubbo.http=h

#dubbo 服务版本号
swagger.dubbo.application.version = 1.0
#dubbo服务groupId
swagger.dubbo.application.groupId = com.deepoove
#dubbo服务artifactId
swagger.dubbo.application.artifactId = dubbo.api

#rpc zk调用 or 本地调用
swagger.dubbo.cluster = rpc

#是否启用swagger-dubbo,默认为true
swagger.dubbo.enable = true

跨域支持

  <!-- 跨域支持,Spring4.3.10+,低版本请设置拦截器开启跨域 -->
  <mvc:cors>
    <mvc:mapping path="/swagger-dubbo/**" allowed-origins="*" />
  </mvc:cors>

SpringBoot 集成 Swagger-dubbo

SpringBoot对配置做了简化,集成swagger-dubbo只需要做第一步就可以了:使用注解 @EnableDubboSwagger开启dubbo的swagger文档。参见spring-boot示例

swagger-dubbo集成注意事项

  • 对于服务接口方法重载,为了在http请求中唯一确认一个方法,需要使用注解@ApiOperation(nickname = "byArea"),通过nickname标记唯一路径(如果不填写,将只显示一个方法)。此时,rest的请求地址为:http://ip:port/h/com.XXX.XxService/method/byArea Stackoverflow:重载的方法能够映射到同一URL地址吗

  • Object对象作为http请求参数为json string格式。 Stackoverflow:POST的方法能够接收多个参数吗?

  • swagger注解既可以写在接口上,也可以写在实现类上。

  • 原生类型作为http请求参数为必填。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].