Skip to content

Commit

Permalink
Initial commit - support for swagger2markup 0.6.3
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Snyder <[email protected]>
  • Loading branch information
Russell Snyder committed Jun 27, 2015
0 parents commit f1b024b
Show file tree
Hide file tree
Showing 11 changed files with 552 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## JetBrains (IntelliJ/IDEA) ignores
*.iml
*.ipr
*.iws
.idea/
.gradle/

## Eclipse ignores
/.settings
.project
.classpath
eclipse-build
*/.project
*/.classpath
*/eclipse-build

## Netbeans ignores
nb-configuration.xml
nbactions.xml

## Java ignores
*.class
target/
generated/
build/
*.jar
*.war
*.ear
dependency-reduced-pom.xml

## Miscellaneous ignores
*~
*.tmp
*.tar.gz
*.tar
*.tgz
*.zip
*.rar

151 changes: 151 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.redowlanalytics</groupId>
<artifactId>swagger2markup-maven-plugin</artifactId>
<version>0.6.3</version>
<packaging>maven-plugin</packaging>

<name>Swagger2Markup Maven Plugin</name>
<description>Swagger2Markup Maven Plugin</description>
<url>https://github.com/redowl/swagger2markup-maven-plugin</url>

<developers>
<developer>
<id>redowl</id>
<name>RedOwl Analytics</name>
<email>[email protected]</email>
<url>http://www.redowlanalytics.com</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>UTC-5</timezone>
</developer>
<developer>
<id>rusnyder</id>
<name>Russell Snyder</name>
<email>[email protected]</email>
<url>http://github.com/rusnyder</url>
<roles>
<role>Contributor</role>
</roles>
<timezone>UTC-5</timezone>
</developer>
</developers>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>

<prerequisites>
<maven>3.0.0</maven>
</prerequisites>

<issueManagement>
<url>https://github.com/redowl/swagger2markup-maven-plugin/issues</url>
<system>GitHub Issues</system>
</issueManagement>

<properties>
<guava.version>18.0</guava.version>
<maven.compiler.plugin.version>3.3</maven.compiler.plugin.version>
<maven.invoker.plugin.version>1.8</maven.invoker.plugin.version>
<maven.plugin.annotations.version>3.4</maven.plugin.annotations.version>
<maven.plugin.api.version>3.3.3</maven.plugin.api.version>
<maven.project.version>2.2.1</maven.project.version>
<project.java.version>1.6</project.java.version>

<!-- Keep the plugin version in sync w/ the swagger2markup version -->
<swagger2markup.version>${project.version}</swagger2markup.version>
</properties>

<dependencies>
<dependency>
<groupId>io.github.robwin</groupId>
<artifactId>swagger2markup</artifactId>
<version>${swagger2markup.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.plugin.api.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>${maven.plugin.annotations.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${project.java.version}</source>
<target>${project.java.version}</target>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>run-its</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>${maven.invoker.plugin.version}</version>
<configuration>
<debug>true</debug>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>validate</postBuildHookScript>
<goals>
<goal>clean</goal>
<goal>process-sources</goal>
</goals>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
<!-- Import Guava for Beanshell validation scripts -->
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
1 change: 1 addition & 0 deletions src/it/swagger-to-asciidoc/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean swagger2markup:process-swagger
32 changes: 32 additions & 0 deletions src/it/swagger-to-asciidoc/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.redowlanalytics</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>

<name>Run Swagger2Markup Convert to Asciidoc</name>
<description>Runs swagger2markup-maven-plugin:process-swagger</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>com.redowlanalytics</groupId>
<artifactId>swagger2markup-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<inputDirectory>src/docs/swagger</inputDirectory>
<outputDirectory>target/docs</outputDirectory>
<markupLanguage>asciidoc</markupLanguage>
</configuration>
</plugin>
</plugins>
</build>
</project>
68 changes: 68 additions & 0 deletions src/it/swagger-to-asciidoc/src/docs/swagger/swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team"
},
"license": {
"name": "MIT"
}
},
"host": "petstore.swagger.io",
"basePath": "/api",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "A list of pets.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
}
}
}
}
},
"definitions": {
"Pet": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
}
28 changes: 28 additions & 0 deletions src/it/swagger-to-asciidoc/validate.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import java.io.*;
import com.google.common.collect.*;

File outputDir = new File( basedir, "target/docs" );

String[] expectedFiles = {
"definitions.adoc",
"overview.adoc",
"paths.adoc"
};

Set existingFiles = Sets.newHashSet( outputDir.list() );

for ( String expectedFile : expectedFiles )
{
System.out.println( "Checking for existence of " + expectedFile );
if ( !existingFiles.remove( expectedFile ) )
{
throw new Exception( "Missing file: " + expectedFile );
}
}

if ( !existingFiles.isEmpty() )
{
throw new Exception( "Found unexpected files: " + existingFiles );
}

return true;
1 change: 1 addition & 0 deletions src/it/swagger-to-markdown/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean swagger2markup:process-swagger
33 changes: 33 additions & 0 deletions src/it/swagger-to-markdown/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.redowlanalytics</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>

<name>Run Swagger2Markup Convert to Asciidoc</name>
<description>Runs swagger2markup-maven-plugin:process-swagger</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>com.redowlanalytics</groupId>
<artifactId>swagger2markup-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<inputDirectory>src/main/swagger</inputDirectory>
<outputDirectory>target/docs</outputDirectory>
<markupLanguage>markdown</markupLanguage>
<separateDefinitions>true</separateDefinitions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit f1b024b

Please sign in to comment.