com.github.hazard4j:swagger4jsonrpc

This project is implementation of swagger for JSON-RPC with Spring Boot. It generates UI that helps delelopers test api and share it with colleagues

Лицензия

Лицензия

Категории

Категории

JSON Данные Swagger Межпрограммное взаимодействие REST Frameworks
Группа

Группа

com.github.hazard4j
Идентификатор

Идентификатор

swagger4jsonrpc
Последняя версия

Последняя версия

0.0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.github.hazard4j:swagger4jsonrpc
This project is implementation of swagger for JSON-RPC with Spring Boot. It generates UI that helps delelopers test api and share it with colleagues
Ссылка на сайт

Ссылка на сайт

https://github.com/hazard4j/swagger
Система контроля версий

Система контроля версий

http://github.com/hazard4j/swagger/tree/master

Скачать swagger4jsonrpc

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.hazard4j/swagger4jsonrpc/ -->
<dependency>
    <groupId>com.github.hazard4j</groupId>
    <artifactId>swagger4jsonrpc</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.hazard4j/swagger4jsonrpc/
implementation 'com.github.hazard4j:swagger4jsonrpc:0.0.2'
// https://jarcasting.com/artifacts/com.github.hazard4j/swagger4jsonrpc/
implementation ("com.github.hazard4j:swagger4jsonrpc:0.0.2")
'com.github.hazard4j:swagger4jsonrpc:jar:0.0.2'
<dependency org="com.github.hazard4j" name="swagger4jsonrpc" rev="0.0.2">
  <artifact name="swagger4jsonrpc" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.hazard4j', module='swagger4jsonrpc', version='0.0.2')
)
libraryDependencies += "com.github.hazard4j" % "swagger4jsonrpc" % "0.0.2"
[com.github.hazard4j/swagger4jsonrpc "0.0.2"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.springframework.boot : spring-boot-starter-web jar
org.apache.commons : commons-lang3 jar 3.4
org.apache.commons : commons-collections4 jar 4.1
io.swagger : swagger-annotations jar 1.5.10
org.projectlombok : lombok jar 1.16.16
com.github.briandilley.jsonrpc4j : jsonrpc4j jar 1.4.6

Модули Проекта

Данный проект не имеет модулей.

Swagger 4 JSON-RPC

About

This project is implementation of Swagger for JSON-RPC with usage of jsonrpc4j

Demo project

Find sources of demo project here: https://github.com/haz4j/swagger4jsonrpc-demo

Usage

How to add swagger magic to your typical jsonrpc4j application?

pom.xml: add swagger annotations and swagger4jsonrpc

    <dependencies>
        <!--spring boot, jsonrpc4j, etc-->
        ...

        <!--add this to generate swagger-ui.html page-->
        <dependency>
            <groupId>com.github.haz4j</groupId>
            <artifactId>swagger4jsonrpc</artifactId>
            <version>0.0.3</version>
        </dependency>
    </dependencies>

Configuration: add @EnableSwagger4JsonRpc and bean Docket

@SpringBootApplication
@Configuration
@EnableSwagger4JsonRpc //add this to enable swagger
public class Config {

    //add this to customize swagger 
    @Bean
    public Docket docket(){
        return Docket.builder().build();
    }

    public static void main(String[] args) {
        SpringApplication.run(Config.class, args);
    }

    @Bean
    @Autowired
    public static AutoJsonRpcServiceImplExporter autoJsonRpcServiceImplExporter() {
        return new AutoJsonRpcServiceImplExporter();
    }
}

Interface: add @Api

@JsonRpcService("/v1/api")
@Api(tags = "api", value = "api") //add this to let swagger know that you want to see it
//on swagger-ui page
public interface ApiInterface {
    Integer save(@JsonRpcParam(value = "value") Integer value);
}

Implementation: do nothing :)

@Service
@AutoJsonRpcServiceImpl
public class Impl implements ApiInterface {
    @Override
    public Integer save(Integer value){
        return value;
    }
}

Launch your spring boot app and check out http://app-path/swagger-ui.html

swagger-ui.html

Версии библиотеки

Версия
0.0.2
0.0.1.RELEASE