@RequirePOST
    @Restricted(NoExternalUse.class)
    public void doCheck(StaplerRequest2 req, StaplerResponse2 res) throws Exception {
        if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
            res.sendError(HttpServletResponse.SC_FORBIDDEN);
            return;
        }

        res.setContentType("application/json");

        try {
            final Map<Source, String> validationIssues = checkWith(YamlSource.of(req));

            // Create JSON array for response
            JSONArray response = new JSONArray();

            // If there are validation issues, add them to the response array
            validationIssues.entrySet().stream()
                    .map(e -> new JSONObject()
                            .accumulate("line", e.getKey() != null ? e.getKey().line : -1)
                            .accumulate("message", e.getValue()))
                    .forEach(response::add);

            // Write the response - will be empty array for valid YAML
            response.write(res.getWriter());

        } catch (ConfiguratorException e) {
            // Return 400 Bad Request for configuration errors
            res.setStatus(HttpServletResponse.SC_BAD_REQUEST);

            JSONArray errors = new JSONArray();
            errors.add(new JSONObject().accumulate("line", -1).accumulate("message", e.getMessage()));

            errors.write(res.getWriter());

        } catch (Exception e) {
            // Return 400 Bad Request for all other errors
            res.setStatus(HttpServletResponse.SC_BAD_REQUEST);

            JSONArray errors = new JSONArray();
            errors.add(new JSONObject()
                    .accumulate("line", -1)
                    .accumulate(
                            "message",
                            e.getMessage() != null
                                    ? e.getMessage()
                                    : e.getClass().getName()));

            errors.write(res.getWriter());
        }
    }
Main entry point to start configuration process.
@throws ConfiguratorException Configuration error
plugin/src/main/java/io/jenkins/plugins/casc/ConfigurationAsCode.java