Swagger to Html

A java tool to convert swagger json to readable doc

Лицензия

Лицензия

Категории

Категории

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

Группа

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

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

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

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

2.0.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

Swagger to Html
A java tool to convert swagger json to readable doc
Ссылка на сайт

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

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

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

https://github.com/chenjianjx/swagger2html

Скачать swagger2html

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

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

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
commons-lang : commons-lang jar 2.6
commons-beanutils : commons-beanutils jar 1.9.2
commons-io : commons-io jar 2.4
org.freemarker : freemarker jar 2.3.20
io.swagger : swagger-parser jar 1.0.13
org.pegdown : pegdown jar 1.6.0

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.9

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

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

swagger2html

Converts swagger jsons to html documents which are readable by everybody.

Swagger-Codegen already has a tool to generate html documents. However, it seems ugly and in lack of information.

petstore-by-swagger-cg


swagger2html produces a neat one:

petstore-by-s2h

Check the full html here.

How to run

Run as a command line tool

mvn clean package 
unzip target/swagger2html*jarset.zip -d /path/to/your/dir
cd /path/to/your/dir/swagger2html*
./s2h.sh http://petstore.swagger.io/v2/swagger.json /path/to/your/result/doc/file.html
# or s2h.bat for windows

Run it inside your application

In your pom.xml, add the following:

	<dependencies>
		...	
		<dependency>
			<groupId>com.github.chenjianjx</groupId>
			<artifactId>swagger2html</artifactId>
			<version>2.0.3</version>
		</dependency>
		...
	</dependencies>	
	Swagger2Html s2h = new Swagger2Html();
	Writer writer = new FileWriter("someFile.html");
	s2h.toHtml("http://petstore.swagger.io/v2/swagger.json", writer);

Customization of CSS

./s2h.sh http://petstore.swagger.io/v2/swagger.json \ 
    /path/to/your/html/doc/file.html -css /path/to/your/css/with/html/tag.html");  

A css template can be found at here. It's not a css file but css snippets and/or external css links in an html file.

In java program, you can

	String cssToInclude = FileUtils.toString("/path/to/your/css/with/html/tag.html");  
	Swagger2Html s2h = new Swagger2Html();
	s2h.toHtml("http://petstore.swagger.io/v2/swagger.json", cssToInclude , writer);

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

Версия
2.0.3
2.0.2
2.0.1
2.0.0