Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Swagger-core is the Java implementation of Swagger. Current version supports *JA
Check out the [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project.

## Get started with Swagger!
See the guide on [getting started with swagger](https://github.com/frantuma/swagger-core/wiki/Swagger-2.X---Getting-started) to get started with adding swagger to your API.
See the guide on [getting started with swagger](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) to get started with adding swagger to your API.

## See the Wiki!
The [github wiki](https://github.com/swagger-api/swagger-core/wiki) contains documentation, samples, contributions, etc. Start there.
Expand Down
117 changes: 117 additions & 0 deletions modules/swagger-gradle-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

# Created by https://www.gitignore.io/api/java,gradle,intellij

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Gradle ###
.gradle
**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties


# End of https://www.gitignore.io/api/java,gradle,intellij

.idea/modules
# IntelliJ IDEA
.idea/
*.iml
*.iws
*.ipr
69 changes: 69 additions & 0 deletions modules/swagger-gradle-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# swagger-gradle-plugin

## Installation
### Gradle 2.1 and higher

```
plugins {
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.0.5-SNAPSHOT"
}
```
### Gradle 1.x and 2.0

```
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.io.swagger.core.v3.swagger-gradle-plugin:2.0.5-SNAPSHOT"
}
}

apply plugin: "io.swagger.core.v3.swagger-gradle-plugin"
```

## Tasks
### resolve

* Resolves project openAPI specification and saves the result in JSON, YAML or both formats.
All parameters except `outputFileName`, `outputFormat`, `classpath`, `skip`, `encoding` and `outputPath` correspond
to `swagger` [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties) with same name.

#### Example Usage

```

resolve {
outputFileName = 'PetStoreAPI'
outputFormat = 'JSON'
prettyPrint = 'TRUE'
classpath = sourceSets.main.runtimeClasspath
resourcePackages = ['io.test']
outputPath = 'test'
}
```

#### Parameters
Parameter | Description | Required | Default
--------- | ----------- | --------- | -------
`classpath`|classpath for resources to scan (swagger and deps already included in classpath)|true|
`outputPath`|output path where file(s) are saved|true|
`outputFileName`|file name (no extension)|false|`openapi`
`outputFormat`|file format (`JSON`, `YAML`, `JSONANDYAML`|false|`JSON`
`skip`|if `TRUE` skip execution|false|`FALSE`
`encoding`|encoding of output file(s)|false|
`resourcePackages`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|
`resourceClasses`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|
`prettyPrint`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|`TRUE`
`openApiFile`|openapi file to be merged with resolved specification, see [config](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|
`filterClass`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|
`readerClass`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|
`scannerClass`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|
`readAllResources`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|
`ignoredRoutes`|see [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties)|false|

***

88 changes: 88 additions & 0 deletions modules/swagger-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// * * * * * * * * * * * *
// Plugins
// * * * * * * * * * * * *
plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'net.researchgate.release' version '2.6.0'
// Publishing publicly
id 'com.gradle.plugin-publish' version '0.10.0'
// Publishing to maven
id 'maven-publish'
}

// * * * * * * * * * * * *
// Dependencies
// * * * * * * * * * * * *

repositories {
jcenter()
mavenLocal()
mavenCentral()
}

dependencies {
compile gradleApi()
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.7'
compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.0.5-SNAPSHOT'
compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'
compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.14.0'
testCompile gradleTestKit()
testCompile 'junit:junit:4+'


}

// * * * * * * * * * * * *
// Project configuration
// * * * * * * * * * * * *

project.description = 'Gradle Plugin for Swagger core'
project.group = 'io.swagger.core.v3'

project.ext.name = 'swagger-gradle-plugin'
project.ext.pluginId = 'io.swagger.core.v3.swagger-gradle-plugin'
project.ext.scm = 'scm:git@github.com:swagger-api/swagger-core.git'
project.ext.url = 'https://github.com/swagger-api/swagger-core/modules/swagger-gradle-plugin'

// Configuration for: java-gradle-plugin
gradlePlugin {
plugins {
swagger {
id = project.pluginId
implementationClass = 'io.swagger.v3.plugins.gradle.SwaggerPlugin'
}
}
}

// * * * * * * * * * * * *
// Publishing
// * * * * * * * * * * * *


// Publishing to plugins.gradle.org
// --------------------------------

// Configuration for: com.gradle.plugin-publish
pluginBundle {
website = project.url
vcsUrl = project.scm
tags = ['swagger', 'openapi', 'api']

plugins {
swagger {
displayName = 'Swagger Gradle Plugin '
description = project.description
id = project.pluginId
}
}
}

publishing {
repositories {
maven {
url mavenLocal().url
}
}
}
1 change: 1 addition & 0 deletions modules/swagger-gradle-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=2.0.5-SNAPSHOT
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Jun 21 16:50:21 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Loading