Docs@skmtc/core

Models

FUNCTION

toRefParts

@skmtc/core 0.63.4

Splits a $ref into RefParts.

A $ref is a URI whose fragment holds a JSON pointer (RFC 6901), so the name is unescaped as one: %20 is a space, and ~1 and ~0 are / and ~. #/components/schemas/Foo%20Bar names the component Foo Bar.

A remote $ref, one that does not start with #, points outside the document, so its refPath does not start with # and it names nothing here: other.yml#/components/schemas/A is refPath other.yml#/components/schemas and refName A. This never throws: a $ref that names nothing is found out when it is resolved.

Signature

import { toRefParts } from '@skmtc/core'

toRefParts(args: ToRefPartsArgs): RefParts

Parameters

args, ToRefPartsArgs required
$ref, string required

Returns