Skip to content

Configuration of inputFile via command line flags is not working #156

Open
@astuetz

Description

I'm trying to specify the inputFile via command line options, as described inside the readme:

./gradlew generateSwagger --inputFile=./specs.json

but this fails with

Option 'inputFile' cannot be cast to type 'java.io.File' in class 'com.yelp.codegen.plugin.GenerateTask'.

I tried many different options of specifying the inputFile parameter, without any success.

After playing around with some custom task and @InputFile / @Option myself, it seems like it would only work if the type is a String (and not a RegularFileProperty). This would be in line with what the Gradle documentation about Option is saying:

https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/options/Option.html

An option may have one of the following types:

  • boolean
  • Boolean
  • Property<Boolean>
  • an enum type
  • Property<T> of an enum type
  • String
  • Property<String>
  • List<T> of an enum type
  • List<String>

I didn't try any other properties, but maybe outputDir could also make problems, as it's a DirectoryProperty.

Plugin version: 1.4.1

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions