UNPKG

@redocly/openapi-core

Version:

See https://github.com/Redocly/redocly-cli

17 lines (15 loc) 507 B
import type { Oas3Rule } from '../../visitors'; export const NoServerExample: Oas3Rule = () => { return { Server(server, { report, location }) { // eslint-disable-next-line no-useless-escape const pattern = /^(.*[\/.])?(example\.com|localhost)([\/:?].*|$)/; if (server.url && pattern.test(server.url)) { report({ message: 'Server `url` should not point to example.com or localhost.', location: location.child(['url']), }); } }, }; };