validate-openapi.mjs 372 B

1234567891011
  1. import { readFileSync } from 'node:fs'
  2. import { parse } from 'yaml'
  3. const doc = parse(readFileSync(new URL('../../docs/openapi.yaml', import.meta.url), 'utf8'))
  4. if (doc.openapi !== '3.1.0') {
  5. throw new Error('openapi version must be 3.1.0')
  6. }
  7. if (!doc.paths || !doc.paths['/api/v1/auth/login']) {
  8. throw new Error('login path is required')
  9. }
  10. console.log('openapi ok')