nginx-proxy-manager/backend/validate-schema.js
Zoey 13f3f0d2f0
merge upstream
Signed-off-by: Zoey <zoey@z0ey.de>
2024-10-15 06:51:17 +02:00

15 lines
445 B
JavaScript
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.

const SwaggerParser = require('@apidevtools/swagger-parser');
const schema = require('./schema');
const log = console.log;
schema.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(' Schema is valid');
} catch (e) {
console.error(e);
log('', e.message, '\n');
process.exit(1);
}
});