Validation.Required: "This criteria specifies that the value must be
not null. Note that this annotation should only be applied to methods
that return nullable objects." [1]

My guess is you should probably try the Integer class instead.

[1] 
https://github.com/apache/beam/blob/451af5133bc0a6416afa7b1844833c153f510181/sdks/java/core/src/main/java/org/apache/beam/sdk/options/Validation.java#L33-L34

Kyle Weaver | Software Engineer | github.com/ibzib |
[email protected] | +16502035555

On Mon, Apr 29, 2019 at 5:12 PM Ning Wang <[email protected]> wrote:
>
> Hi, Beam devs,
>
> I am working on a runner and found something not working as expected.
>
> I have this field in my H*PipelineOptions,
> ```
>   @Description("Number of Containers")
>   @Validation.Required
>   int getNumberOfContainers();
>   void setNumberOfContainers(int value);
> ```
> and I am calling this validation function,
> ```
> H*PipelineOptions options =
>     PipelineOptionsValidator.validate(H*PipelineOptions.class, opts);
> ```
>
> I am expecting that if --numberOfContainer is missing in command line, there 
> should be an error, however it seems like the value is set to 0 by default.
>
> Is this the expected behavior? Or is there anything missing? My Beam version 
> is 2.11.0.
>
> Thanks in advance!
> --ning
>

Reply via email to