import { Ajv } from "ajv" ; import { JSONSchema6 } from "json-schema" ; import { default as ResolveLib } from "../libs/resolve" ; param { string } $id param { JSONSchema6 } schema param { Ajv } ajv return { JSONSchema6 } export default ( $id , schema , ajv ) : JSONSchema6 => { if ( ! schema ) { return schema ; } const definitions = schema . definitions ; if ( definitions ) { for ( const key in definitions ) { if ( definitions . hasOwnProperty ( key ) ) { const element = definitions [ key ] ; if ( element !== false && element !== true ) { new ResolveLib ( ajv , element , `${ schema . $id }#/definitions/${ key }` ) ; } } } } return schema ; } ;