spring-shell icon indicating copy to clipboard operation
spring-shell copied to clipboard

Cannot validate multiple required Option

Open libe opened this issue 1 year ago • 0 comments
trafficstars

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!

libe avatar Nov 21 '24 14:11 libe