Skip to content

Cannot validate multiple required Option #1150

@libe

Description

@libe

I am having trouble validating multiple required Option, here's my example:

@Command(command = "dataset", group = "Dataset Commands")
class DatasetCommands {
    @Command(command = "describe", description = "Describe a dataset by id")
    String findById(@Option(required = true, description = "Project id") String projectId, 
                    @Option(required = true, description = "Dataset id") String datasetId)  {
        return String.format("Got projectId %s datasetId %s", projectId, datasetId);
    }
}

So I launch the command with

dataset describe 1

I get

Got projectId 1 datasetId null

I would have expected to get something like "not all options are passed" exception but strange the command is executed with the second option null.

Any idea if I am doing something wrong?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions