forked from swagger-api/swagger-play
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref swagger-api#214 - Vendor Extensions support in API Info
- Loading branch information
Gabriel Ciuloaica
committed
Dec 27, 2019
1 parent
7ddfaa3
commit 299a868
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
api.version = beta | ||
|
||
swagger.filter = null | ||
swagger.api { | ||
basepath = "/" | ||
host = "localhost:9000" | ||
title = "Test API" | ||
schemes = [] | ||
|
||
info { | ||
title = "Test" | ||
description = "Test API endpoint" | ||
termsOfServiceUrl = "" | ||
contact = "[email protected]" | ||
license = "Apache2" | ||
licenseUrl = "http://licenseUrl" # needs to be a valid url to validate against schema | ||
x-api-key: "test" | ||
x-tags: ["test", "api"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import com.typesafe.config.ConfigFactory | ||
import org.specs2.mutable.Specification | ||
import play.modules.swagger.PlaySwaggerConfig | ||
|
||
class PlayApiInfoConfigParserSpec extends Specification { | ||
|
||
private val config = ConfigFactory.load() | ||
|
||
"API Info " should { | ||
"proper build Info object" in { | ||
val probe = PlaySwaggerConfig(config) | ||
probe.title === "Test" | ||
probe.description === "Test API endpoint" | ||
probe.termsOfServiceUrl.isEmpty === true | ||
probe.contact === "[email protected]" | ||
probe.license === "Apache2" | ||
probe.licenseUrl === "http://licenseUrl" | ||
probe.vendorExtensions.size shouldEqual(2) | ||
probe.vendorExtensions.head.name === "x-api-key" | ||
probe.vendorExtensions.head.value === "test" | ||
probe.vendorExtensions.tail.head.name === "x-tags" | ||
probe.vendorExtensions.tail.head.value === java.util.Arrays.asList("test", "api") | ||
} | ||
} | ||
} |