# RefParts

TYPE in `@skmtc/core 0.63.4`

Where a `$ref` points, in two parts: `refPath`, the JSON pointer before its
last segment, and `refName`, that last segment unescaped.
`#/components/schemas/Pet` is `refPath` `#/components/schemas` and `refName`
`Pet`. `#/components/schemas/__sharedInput/$defs/schema0` is `refPath`
`#/components/schemas/__sharedInput/$defs` and `refName` `schema0`.

`refPath` has one spelling, whatever the `$ref` has: no percent escapes, and
`~` and `/` in a segment as `~0` and `~1` (RFC 6901). Two refs to one place
have equal parts.

The model API takes a model's ref in this shape (`insertModel(Peer, ref)`,
`toIdentifierName({ ref, … })`), so the two parts travel together. An
`OasRef` has both fields and fits it as it is.

## Signature

```ts
import type { RefParts } from '@skmtc/core'
```

## Properties

- `refName` (RefName, required): The last segment of the pointer, unescaped. Empty for a `$ref` that ends in `/`.
- `refPath` (string, required): The pointer before the last segment, starting with `#`, with no percent escapes. A remote `$ref` (`isRemoteRefPath`) has the file before the `#`.
