Skip to content

client-required-false

Id
@azure-tools/typespec-java/client-required-false

Severity: error

This diagnostic is issued when the Java clientRequired client option is explicitly set to false.

Java client generation fails because the option only supports promoting a parameter to required; it cannot make a required parameter optional.

model ReadOptions {
@query filter: string;
}
op read(...ReadOptions): void;
@@clientOption(ReadOptions.filter, "clientRequired", false, "java");
Client option 'clientRequired' can only be set to 'true'.

Remove the client option, or set it to true for an optional TypeSpec parameter that must be required in the Java client.

model ReadOptions {
@query filter?: string;
}
op read(...ReadOptions): void;
@@clientOption(ReadOptions.filter, "clientRequired", true, "java");