@@ -18,7 +18,7 @@ import { OpenAPIV3 } from 'openapi-types'
1818
1919import { buildRestOperation } from './rest.operation'
2020import type { OperationsBuilder } from '../../types'
21- import { removeComponents , removeFirstSlash , slugify } from '../../utils'
21+ import { removeComponents , removeFirstSlash , slugify , takeIf } from '../../utils'
2222import { getOperationBasePath } from './rest.utils'
2323import type * as TYPE from './rest.types'
2424import { HASH_FLAG , INLINE_REFS_FLAG , MESSAGE_SEVERITY , NORMALIZE_OPTIONS , ORIGINS_SYMBOL } from '../../consts'
@@ -37,6 +37,18 @@ export const buildRestOperations: OperationsBuilder<OpenAPIV3.Document> = async
3737 originsFlag : ORIGINS_SYMBOL ,
3838 hashFlag : HASH_FLAG ,
3939 source : document . data ,
40+ ...takeIf ( {
41+ onRefResolveError : ( message : string , path : PropertyKey [ ] , ref : string ) => {
42+ // console.debug([
43+ // '[Ref Resolve Error]',
44+ // `Message: ${message}`,
45+ // `JSON path: ${path}`,
46+ // `Ref: ${ref}`,
47+ // ].join('\n'))
48+ // todo is this message enough? (ErrorMessage.refNotFound)
49+ throw new Error ( message )
50+ } ,
51+ } , ! ! ctx . config . strictValidation ) ,
4052 } ,
4153 ) as OpenAPIV3 . Document
4254 const refsOnlyDocument = normalize (
0 commit comments