/**
 * Represent a json reference.
 */ export interface JsonRef { file ? : string ; path ? : string ; } param ref returns export function parseJsonRef ( ref ) { const [ file , path ] = ref . split ( "#" ) ; return { file : file === "" ? undefined : file , path } ; } param ref returns export function stringifyJsonRef ( ref ) { const path = ref . path === undefined ? "" : `#${ ref . path }` ; return `${ ref . file ?? "" }${ path }` ; } param document param modifier export function updateJsonRefs < T extends { } | ArrayLike < { } > > ( document , modifier ) { for ( const value of Object . values ( document ) ) { if ( value && typeof value === "object" ) { const ref = ( value as any ) . $ref ; if ( ref && typeof ref === "string" ) { ( value as any ) . $ref = modifier ( ref ) ; } updateJsonRefs ( value as any , modifier ) ; } } return document ; }