@ShellMethod(key = "validate-service", value = "Validate a given JSON/YAML service definition by path or directory")
    public void validateService(
        @ShellOption(value = {"file", "--file"},
            help = "Path to the JSON/YAML service definition file",
            defaultValue = StringUtils.EMPTY)
        final String file,
        @ShellOption(value = {"directory", "--directory"},
            help = "Path to the JSON/YAML service definitions directory",
            defaultValue = StringUtils.EMPTY)
        final String directory) {

        if (StringUtils.isNotBlank(file)) {
            val filePath = new File(file);
            validate(filePath);
            return;
        }
        if (StringUtils.isNotBlank(directory)) {
            val directoryPath = new File(directory);
            if (directoryPath.isDirectory()) {
                FileUtils.listFiles(directoryPath, new String[]{"json", "yml", "yaml"}, false)
                    .forEach(this::validate);
            }
        }
    }
Validate service.

@param file      the file
@param directory the directory
support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/services/ValidateRegisteredServiceCommand.java