Files
nginx-proxy-manager/backend/validate-schema.js
Jamie Curnow 330993f028 Convert backend to ESM
- About 5 years overdue
- Remove eslint, use bomejs instead
2025-10-02 08:10:18 +10:00

20 lines
521 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/node
import SwaggerParser from "@apidevtools/swagger-parser";
import chalk from "chalk";
import { getCompiledSchema } from "./schema/index.js";
const log = console.log;
getCompiledSchema().then(async (swaggerJSON) => {
try {
const api = await SwaggerParser.validate(swaggerJSON);
console.log("API name: %s, Version: %s", api.info.title, api.info.version);
log(chalk.green(" Schema is valid"));
} catch (e) {
console.error(e);
log(chalk.red("", e.message), "\n");
process.exit(1);
}
});