Runtime documentation of REST APIs

Runtime documentation of REST APIs based on the Spring and JAXB annotations.

Лицензия

Лицензия

Группа

Группа

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

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

spring-rest-doc
Последняя версия

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

1.6.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Runtime documentation of REST APIs
Runtime documentation of REST APIs based on the Spring and JAXB annotations.
Ссылка на сайт

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

https://github.com/lbehnke/spring-rest-doc
Организация-разработчик

Организация-разработчик

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

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

https://github.com/lbehnke/spring-rest-doc

Скачать spring-rest-doc

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

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

Зависимости

compile (8)

Идентификатор библиотеки Тип Версия
com.google.guava : guava jar 18.0
org.reflections : reflections jar 0.9.8
org.javassist : javassist jar 3.18.1-GA
org.springframework : spring-core jar 4.1.4.RELEASE
org.springframework : spring-web jar 4.1.4.RELEASE
ch.qos.logback : logback-classic jar 1.1.2
org.slf4j : log4j-over-slf4j jar 1.7.6
org.slf4j : jcl-over-slf4j jar 1.7.6

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.mockito : mockito-all jar 1.10.19
org.springframework : spring-test jar 4.1.4.RELEASE

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

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

Spring REST Doc

This is a simple runtime REST API documentation generator based on JSONDoc 1.0.1. It reads Spring MVC, JAXB annotations, and a set of own annotations.

Example data transfer object returned by the REST controller:

@ApiModelDoc("Data transfer object that represents an user account.")
@XmlType(namespace = Namespaces.NS_DTO)
@XmlRootElement(name="siteUser")
public class AppUserDTO {

    @XmlAttribute(required = true)
    private String loginName;
    
    private String name;
    
    @XmlElement(required = true)
    private String email;

    [...]
    
}

Example REST Controller:

@ApiDoc(name="User resource", description="REST resource for administrating user accounts. Only acessible for users with administrator privilege.")
@RestController
@RequestMapping(value="/users")
public class UserResource {

    @ApiMethodDoc("Returns a list of user accounts. Operation is available for administrators only.")
    @ApiErrorsDoc({
            @ApiErrorDoc(
                    code = 401,
                    description="Insufficient user privileges to access this operation."),
    })
	@RequestMapping(method=RequestMethod.GET)
	public AppUserListDTO findUsers(
            @RequestParam(value = "filter", required = false) @ApiParamDoc("Optional parameter that limits the result list to users with names containing the filter term as substring.") String filter,
            @RequestParam(value = "pageno", required = false) @ApiParamDoc("Page to be returned") Integer pageNo,
            @RequestParam(value = "pagesize", required = false) @ApiParamDoc("Page size") Integer pageSize,
            HttpServletRequest request) throws Exception
    {
        return userService.findAppUsers(filter, new PagingInfoDTO(pageNo, pageSize));
	}
	
	[...]
	
}

Here is how the documentation is returned as XML or JSON object:

private static  String[] PKG_NAMES = new String[]{
        "example.web.rest",
        "example.common.dto",
};

private DocumentationFactory documentationFactory = new DefaultDocumentationFactory();

@ApiMethodDoc("Returns the API documentation as JSON or XML document.")
@RequestMapping(value="/doc",method=RequestMethod.GET)
public Documentation getDocumentation() {
    return documentationFactory.createDocumentation("1.0", "http://www.mydomain.org/api", PKG_NAMES);
}

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

Версия
1.6.1
1.6
1.5
1.4
1.3
1.2
1.1