Skip to content

Swagger Codegen Custom Generator - to generate Slate API documentation for a Swagger spec

Notifications You must be signed in to change notification settings

regga-ws/swagger-codegen-slate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

swagger-codegen-slate

Introduction

Swagger Codegen generator to generate Slate API documentation for a Swagger spec.

Based on the contents of the Swagger spec (tags, operations, resources), the generator creates an index.html.md file which should be put in the slate/source directory before running the bundle exec middleman build command.

More information about Swagger Codegen and Slate at https://github.com/swagger-api/swagger-codegen and https://github.com/lord/slate.

Screenshot

Minimal configuration

<plugin>
	<groupId>io.swagger</groupId>
	<artifactId>swagger-codegen-maven-plugin</artifactId>
	<version>2.2.2-SNAPSHOT</version>
	<executions>
		<execution>
			<phase>install</phase>
			<goals>
				<goal>generate</goal>
			</goals>
			<configuration>
				<language>ws.regga.codegenslate.SlateCodegen</language>
				<inputSpec>http://petstore.swagger.io/v2/swagger.json</inputSpec>		
			</configuration>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>ws.regga</groupId>
			<artifactId>swagger-codegen-slate</artifactId>
			<version>1.0.0</version>
		</dependency>
	</dependencies>
</plugin>

Configuration with custom template

<plugin>
	<groupId>io.swagger</groupId>
	<artifactId>swagger-codegen-maven-plugin</artifactId>
	<version>2.2.2-SNAPSHOT</version>
	<executions>
		<execution>
			<phase>install</phase>
			<goals>
				<goal>generate</goal>
			</goals>
			<configuration>
				<language>ws.regga.codegenslate.SlateCodegen</language>
				<inputSpec>http://petstore.swagger.io/v2/swagger.json</inputSpec>
				<!-- must contain index.html.md.mustache -->
				<templateDirectory>custom-template-dir</templateDirectory>
			</configuration>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>ws.regga</groupId>
			<artifactId>swagger-codegen-slate</artifactId>
			<version>1.0.0</version>
		</dependency>
	</dependencies>
</plugin>

Configuration to keep ordering of tags and operations from the Swagger spec

<plugin>
	<groupId>io.swagger</groupId>
	<artifactId>swagger-codegen-maven-plugin</artifactId>
	<version>2.2.2-SNAPSHOT</version>
	<executions>
		<execution>
			<phase>install</phase>
			<goals>
				<goal>generate</goal>
			</goals>
			<configuration>
				<language>ws.regga.codegenslate.SlateCodegen</language>
				<inputSpec>http://petstore.swagger.io/v2/swagger.json</inputSpec>
				<configOptions>
				  <keepOriginalOrder>true</keepOriginalOrder>
				</configOptions>    
			</configuration>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>ws.regga</groupId>
			<artifactId>swagger-codegen-slate</artifactId>
			<version>1.0.0</version>
		</dependency>
	</dependencies>
</plugin>

About

Swagger Codegen Custom Generator - to generate Slate API documentation for a Swagger spec

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published