File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
modules/openapi-generator-gradle-plugin/src
main/kotlin/org/openapitools/generator/gradle/plugin Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ class OpenApiGeneratorPlugin : Plugin<Project> {
117117 additionalProperties.set(generate.additionalProperties)
118118 serverVariables.set(generate.serverVariables)
119119 languageSpecificPrimitives.set(generate.languageSpecificPrimitives)
120+ openapiGeneratorIgnoreList.set(generate.openapiGeneratorIgnoreList)
120121 importMappings.set(generate.importMappings)
121122 schemaMappings.set(generate.schemaMappings)
122123 inlineSchemaNameMappings.set(generate.inlineSchemaNameMappings)
Original file line number Diff line number Diff line change @@ -570,4 +570,55 @@ class GenerateTaskDslTest : TestBase() {
570570 " Dry run results message is missing."
571571 )
572572 }
573+
574+ @Test
575+ fun `openapiGenerate should set openapiGeneratorIgnoreList option` () {
576+ // Arrange
577+ val projectFiles = mapOf (
578+ " spec.yaml" to javaClass.classLoader.getResourceAsStream(" specs/petstore-v3.0.yaml" )
579+ )
580+ withProject(
581+ """
582+ plugins {
583+ id 'org.openapi.generator'
584+ }
585+ openApiGenerate {
586+ generatorName = "kotlin"
587+ inputSpec = file("spec.yaml").absolutePath
588+ outputDir = file("build/kotlin").absolutePath
589+ apiPackage = "org.openapitools.example.api"
590+ invokerPackage = "org.openapitools.example.invoker"
591+ modelPackage = "org.openapitools.example.model"
592+ configOptions = [
593+ dateLibrary: "java8"
594+ ]
595+ openapiGeneratorIgnoreList = ["README.md"]
596+ }
597+ """ .trimIndent(),
598+ projectFiles
599+ )
600+
601+ // Act
602+ val result = GradleRunner .create()
603+ .withProjectDir(temp)
604+ .withArguments(" openApiGenerate" )
605+ .withPluginClasspath()
606+ .build()
607+
608+ // Assert
609+ assertTrue(
610+ result.output.contains(" Successfully generated code to" ),
611+ " User friendly generate notice is missing."
612+ )
613+
614+ assertTrue(
615+ " README.md" !in File (temp, " build/kotlin/" ).list(),
616+ " README.md should not be generated when it is in the openapiGeneratorIgnoreList."
617+ )
618+
619+ assertEquals(
620+ TaskOutcome .SUCCESS , result.task(" :openApiGenerate" )?.outcome,
621+ " Expected a successful run, but found ${result.task(" :openApiGenerate" )?.outcome} "
622+ )
623+ }
573624}
You can’t perform that action at this time.
0 commit comments