Repository: kestra-io/kestra
File: cli/src/main/java/io/kestra/cli/commands/flows/FlowValidateCommand.java (Java)

Code before:
import io.kestra.core.models.validations.ModelValidator;
import io.kestra.core.services.FlowService;
import jakarta.inject.Inject;
import picocli.CommandLine;

import java.util.ArrayList;
import java.util.List;

@CommandLine.Command(
    name = "validate",
    description = "Validate a flow"
)
public class FlowValidateCommand extends AbstractValidateCommand {
    @Inject
    private ModelValidator modelValidator;

    @Inject
    private FlowService flowService;

    @Inject
    private TenantIdSelectorService tenantIdSelectorService;

    @Override
    public Integer call() throws Exception {
        return this.call(
            FlowWithSource.class,
            modelValidator,
            (Object object) -> {
                FlowWithSource flow = (FlowWithSource) object;
                return flow.getNamespace() + "." + flow.getId();
            },
            (Object object) -> {
                FlowWithSource flow = (FlowWithSource) object;
                List<String> warnings = new ArrayList<>();
                warnings.addAll(flowService.deprecationPaths(flow).stream().map(deprecation -> deprecation + " is deprecated").toList());
                warnings.addAll(flowService.warnings(flow, tenantIdSelectorService.getTenantIdAndAllowEETenants(tenantId)));
                return warnings;
            },
            (Object object) -> {
                FlowWithSource flow = (FlowWithSource) object;
                return flowService.relocations(flow.sourceOrGenerateIfNull()).stream().map(relocation -> relocation.from() + " is replaced by " + relocation.to()).toList();
            }
        );
    }
}


Review comment (suggestion):
```suggestion
        stdErr("WARNING: this command is deprecated, use `kestractl flows validate` instead. Unless you need to validate Flows in a offline mode (in CI for example) and don't want to rely on a running Kestra instance");
```

Code after:
import io.kestra.core.models.validations.ModelValidator;
import io.kestra.core.services.FlowService;
import jakarta.inject.Inject;
import picocli.CommandLine;

import java.util.ArrayList;
import java.util.List;

@CommandLine.Command(
    name = "validate",
    description = "Validate a flow"
)
@Deprecated(forRemoval = true, since = "1.3.0")
public class FlowValidateCommand extends AbstractValidateCommand {
    @Inject
    private ModelValidator modelValidator;

    @Inject
    private FlowService flowService;

    @Inject
    private TenantIdSelectorService tenantIdSelectorService;

    @Override
    public Integer call() throws Exception {
        stdErr("WARNING: this command is deprecated, use `kestractl flows validate` instead");

        return this.call(
            FlowWithSource.class,
            modelValidator,
            (Object object) -> {
                FlowWithSource flow = (FlowWithSource) object;
                return flow.getNamespace() + "." + flow.getId();
            },
            (Object object) -> {
                FlowWithSource flow = (FlowWithSource) object;
                List<String> warnings = new ArrayList<>();
                warnings.addAll(flowService.deprecationPaths(flow).stream().map(deprecation -> deprecation + " is deprecated").toList());
                warnings.addAll(flowService.warnings(flow, tenantIdSelectorService.getTenantIdAndAllowEETenants(tenantId)));
                return warnings;
            },
            (Object object) -> {
                FlowWithSource flow = (FlowWithSource) object;
                return flowService.relocations(flow.sourceOrGenerateIfNull()).stream().map(relocation -> relocation.from() + " is replaced by " + relocation.to()).toList();
            }
        );
    }
}