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
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ class GenerateTaskDslTest : TestBase() {
@Test
fun `openApiGenerate should create an expected file structure from URL config`() {
val specUrl = "https://raw.githubusercontent.com/OpenAPITools/openapi-generator/b6b8c0db872fb4a418ae496e89c7e656e14be165/modules/openapi-generator-gradle-plugin/src/test/resources/specs/petstore-v3.0.yaml"
val urlParams ="?meaningless=params&so=it&results=in&illegal=filenames&on=windows"
// Arrange
val buildContents = """
plugins {
id 'org.openapi.generator'
}
openApiGenerate {
generatorName = "kotlin"
remoteInputSpec = "$specUrl"
remoteInputSpec = "$specUrl$urlParams"
outputDir = file("build/kotlin").absolutePath
apiPackage = "org.openapitools.example.api"
invokerPackage = "org.openapitools.example.invoker"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ private File getHashFile(File inputSpecFile) {
String name = inputSpecFile.getName();

URL url = inputSpecRemoteUrl();
if (inputSpecFile.exists() && url != null) {
if (url != null) {
String[] segments = url.getPath().split("/");
name = Files.getNameWithoutExtension(segments[segments.length - 1]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public void testCommonConfigurationWithJARInputSpec() throws Exception {
testCommonConfiguration("jar");
}

public void testCommonConfigurationWithRemoteInputSpec() throws Exception {
testCommonConfiguration("remote");
}

@SuppressWarnings("unchecked")
private void testCommonConfiguration(String profile) throws Exception {
CodeGenMojo mojo = loadMojo(newTempFolder(), "src/test/resources/default", profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>remote</id>
<properties>
<inputSpec>https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml?meaningless=params&amp;so=it&amp;results=in&amp;illegal=filenames&amp;on=windows</inputSpec>
</properties>
</profile>
</profiles>
<build>
<finalName>common-maven</finalName>
Expand Down
Loading