moonrockz/openrpc/reference

Types

Authority

pub struct Authority {
  raw : String
  userinfo : String?
  host : Host
  port : String?
} derive(@moonbitlang/core/debug.Debug)

Source

Authority::host

fn Authority::host(self : Authority) -> Host

Source

Authority::port

fn Authority::port(self : Authority) -> String?

Port is an exact digit token. Generic URI syntax imposes no transport range.

Source

Authority::text

fn Authority::text(self : Authority) -> String

Source

Authority::to_repr

fn Authority::to_repr(Authority) -> @moonbitlang/core/debug.Repr

Source

Authority::userinfo

fn Authority::userinfo(self : Authority) -> String?

Source

Host

pub enum Host {
  RegisteredName(String)
  Ipv4(String)
  Ipv6(String)
  IpvFuture(String)
} derive(@moonbitlang/core/debug.Debug)

Source

Host::to_repr

fn Host::to_repr(Host) -> @moonbitlang/core/debug.Repr

Source

JsonPointer

pub struct JsonPointer {
  // private fields
} derive(@moonbitlang/core/debug.Debug)

Source

JsonPointer::from_tokens

fn JsonPointer::from_tokens(parts : Array[String], limits? : @moonrockz/openrpc/json.Limits) -> Result[JsonPointer, @moonrockz/openrpc/json.Diagnostic]

Source

JsonPointer::parse

fn JsonPointer::parse(text : String, limits? : @moonrockz/openrpc/json.Limits) -> Result[JsonPointer, @moonrockz/openrpc/json.Diagnostic]

Parse the plain RFC 6901 representation, without URI percent decoding.

Source

JsonPointer::resolve

fn JsonPointer::resolve(self : JsonPointer, root : @moonrockz/openrpc/json.Value, limits? : @moonrockz/openrpc/json.Limits) -> Result[@moonrockz/openrpc/json.Value, @moonrockz/openrpc/json.Diagnostic]

Source

JsonPointer::to_repr

fn JsonPointer::to_repr(JsonPointer) -> @moonbitlang/core/debug.Repr

Source

JsonPointer::to_string

fn JsonPointer::to_string(self : JsonPointer) -> String

Source

JsonPointer::tokens

fn JsonPointer::tokens(self : JsonPointer) -> Array[String]

Source

Location

pub struct Location {
  resource : UriReference?
  pointer : JsonPointer
  target : @moonrockz/openrpc/json.Value
} derive(@moonbitlang/core/debug.Debug)

An owned resolved target: the owning resource's retrieval URI (None for an unnamed input document), the pointer within it, and the immutable value found there.

Source

Location::identity

fn Location::identity(self : Location) -> String

Normalized resource identity plus pointer; equal for every access path.

Source

Location::pointer

fn Location::pointer(self : Location) -> JsonPointer

Source

Location::resource

fn Location::resource(self : Location) -> UriReference?

Source

Location::target

fn Location::target(self : Location) -> @moonrockz/openrpc/json.Value

Source

Location::to_repr

fn Location::to_repr(Location) -> @moonbitlang/core/debug.Repr

Source

Reference

pub struct Reference {
  uri : UriReference
  fragment : ReferenceFragment
} derive(@moonbitlang/core/debug.Debug)

Source

Reference::fragment

fn Reference::fragment(self : Reference) -> ReferenceFragment

Source

Reference::from_uri

fn Reference::from_uri(uri : UriReference, limits? : @moonrockz/openrpc/json.Limits) -> Result[Reference, @moonrockz/openrpc/json.Diagnostic]

Source

Reference::local_pointer

fn Reference::local_pointer(self : Reference) -> JsonPointer?

Source

Reference::parse

fn Reference::parse(text : String, limits? : @moonrockz/openrpc/json.Limits) -> Result[Reference, @moonrockz/openrpc/json.Diagnostic]

Checked JSON-target reference; reading performs no resolution or fetching.

Source

Reference::resolve

fn Reference::resolve(self : Reference, base : UriReference, limits? : @moonrockz/openrpc/json.Limits) -> Result[Reference, @moonrockz/openrpc/json.Diagnostic]

Source

Reference::text

fn Reference::text(self : Reference) -> String

Source

Reference::to_repr

fn Reference::to_repr(Reference) -> @moonbitlang/core/debug.Repr

Source

Reference::uri

fn Reference::uri(self : Reference) -> UriReference

Source

ReferenceFragment

pub enum ReferenceFragment {
  WholeResource
  PointerFragment(JsonPointer)
  IdentifierFragment(String)
} derive(@moonbitlang/core/debug.Debug)

Source

ReferenceFragment::to_repr

fn ReferenceFragment::to_repr(ReferenceFragment) -> @moonbitlang/core/debug.Repr

Source

ReferenceStep

pub struct ReferenceStep {
  site : Location?
  reference : Reference
  resolved : UriReference?
} derive(@moonbitlang/core/debug.Debug)

One reference in a chain: where it appeared (None for the initial input), its source text, and its absolute form when a base was available.

Source

ReferenceStep::reference

fn ReferenceStep::reference(self : ReferenceStep) -> Reference

Source

ReferenceStep::resolved

fn ReferenceStep::resolved(self : ReferenceStep) -> UriReference?

Source

ReferenceStep::site

fn ReferenceStep::site(self : ReferenceStep) -> Location?

Source

ReferenceStep::to_repr

fn ReferenceStep::to_repr(ReferenceStep) -> @moonbitlang/core/debug.Repr

Source

Resolution

pub struct Resolution {
  target : Location?
  complete : Bool
  // private fields
} derive(@moonbitlang/core/debug.Debug)

A resolution result. complete is false when the answer depends on input that was not supplied or on work beyond the limits; a broken pointer or a cycle is a complete failure.

Source

Resolution::chain

fn Resolution::chain(self : Resolution) -> Array[ReferenceStep]

Source

Resolution::complete

fn Resolution::complete(self : Resolution) -> Bool

Source

Resolution::diagnostics

fn Resolution::diagnostics(self : Resolution) -> Array[@moonrockz/openrpc/json.Diagnostic]

Source

Resolution::target

fn Resolution::target(self : Resolution) -> Location?

Source

Resolution::to_repr

fn Resolution::to_repr(Resolution) -> @moonbitlang/core/debug.Repr

Source

Resource

pub struct Resource {
  uri : UriReference
  value : @moonrockz/openrpc/json.Value
  // private fields
} derive(@moonbitlang/core/debug.Debug)

An immutable caller-supplied JSON resource. Its retrieval URI and aliases are absolute and fragment-free; the value can be any extracted JSON fragment.

Source

Resource::aliases

fn Resource::aliases(self : Resource) -> Array[UriReference]

Source

Resource::new

fn Resource::new(uri : UriReference, value : @moonrockz/openrpc/json.Value, aliases? : Array[UriReference], schema_roots? : Array[JsonPointer], limits? : @moonrockz/openrpc/json.Limits) -> Result[Resource, @moonrockz/openrpc/json.Diagnostic]

Source

Resource::schema_roots

fn Resource::schema_roots(self : Resource) -> Array[JsonPointer]

Locations whose values are declared draft-07 schema roots.

Source

Resource::to_repr

fn Resource::to_repr(Resource) -> @moonbitlang/core/debug.Repr

Source

Resource::uri

fn Resource::uri(self : Resource) -> UriReference

Source

Resource::value

fn Resource::value(self : Resource) -> @moonrockz/openrpc/json.Value

Source

ResourceSet

pub struct ResourceSet {
  root_base : UriReference?
  // private fields
} derive(@moonbitlang/core/debug.Debug)

Explicit immutable resource snapshots with an optional root base URI. Lookup uses syntax-based URI identity and never retrieves anything.

Source

ResourceSet::empty

fn ResourceSet::empty() -> ResourceSet

Source

ResourceSet::follow

fn ResourceSet::follow(self : ResourceSet, reference : Reference, next : (Location) -> Reference?, base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> Resolution

Follow a reference chain while next reports that a target is itself a reference. Each later reference resolves against its owning resource URI. Revisiting a location is a ReferenceCycle; chains longer than max_depth are incomplete.

Source

ResourceSet::get

fn ResourceSet::get(self : ResourceSet, uri : UriReference) -> Resource?

The resource registered under the fragment-free identity of uri.

Source

ResourceSet::new

fn ResourceSet::new(resources : Array[Resource], root_base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> Result[ResourceSet, @moonrockz/openrpc/json.Diagnostic]

Source

ResourceSet::resolve

fn ResourceSet::resolve(self : ResourceSet, reference : Reference, base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> Resolution

Resolve one reference against the explicit resources. A relative reference uses base, else the set's root base. Nothing is fetched or executed.

Source

ResourceSet::resources

fn ResourceSet::resources(self : ResourceSet) -> Array[Resource]

Source

ResourceSet::root_base

fn ResourceSet::root_base(self : ResourceSet) -> UriReference?

Source

ResourceSet::to_repr

fn ResourceSet::to_repr(ResourceSet) -> @moonbitlang/core/debug.Repr

Source

SchemaIndex

pub struct SchemaIndex {
  // private fields
} derive(@moonbitlang/core/debug.Debug)

Draft-07 identifier scopes over declared schema roots. Indexing walks only draft-07 subschema positions: literal keywords, unknown keywords, $ref siblings and declared foreign dialects never establish identifiers. The optional input is the caller's own document, named by input_base when it has one, and is never registered as a resource.

Source

SchemaIndex::complete

fn SchemaIndex::complete(self : SchemaIndex) -> Bool

False when identifiers could not all be indexed: missing bases, undefined fragment forms or exhausted limits.

Source

SchemaIndex::diagnostics

fn SchemaIndex::diagnostics(self : SchemaIndex) -> Array[@moonrockz/openrpc/json.Diagnostic]

Source

SchemaIndex::indexed_scope

fn SchemaIndex::indexed_scope(self : SchemaIndex, identity : String) -> UriReference??

The scope recorded for the indexed schema whose Location::identity is identity, or None when that location was not indexed.

Source

SchemaIndex::locate

fn SchemaIndex::locate(self : SchemaIndex, resource : UriReference?, pointer : JsonPointer, limits? : @moonrockz/openrpc/json.Limits) -> Result[Location, @moonrockz/openrpc/json.Diagnostic]

The physical location at pointer in a registered resource, or in the input when resource is None or names the input base.

Source

SchemaIndex::new

fn SchemaIndex::new(resources : ResourceSet, input? : @moonrockz/openrpc/json.Value?, input_base? : UriReference?, input_roots? : Array[JsonPointer], limits? : @moonrockz/openrpc/json.Limits) -> SchemaIndex

Source

SchemaIndex::resolve

fn SchemaIndex::resolve(self : SchemaIndex, reference : Reference, base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> Resolution

Resolve a schema reference from a site whose scope is base. Without a base, the input's base or else the set's root base applies; a same-document reference in an unnamed input targets that input.

Source

SchemaIndex::resources

fn SchemaIndex::resources(self : SchemaIndex) -> ResourceSet

Source

SchemaIndex::scope

fn SchemaIndex::scope(self : SchemaIndex, location : Location) -> UriReference?

The base URI in effect for the schema at location: its nearest $id scope when indexed, otherwise its document's retrieval URI. A relative result means the scope is undetermined for lack of an absolute base.

Source

SchemaIndex::to_repr

fn SchemaIndex::to_repr(SchemaIndex) -> @moonbitlang/core/debug.Repr

Source

UriReference

pub struct UriReference {
  raw : String
  scheme : String?
  authority : Authority?
  path : String
  query : String?
  fragment : String?
} derive(@moonbitlang/core/debug.Debug)

Checked generic RFC3986 URI-reference components, with original spelling.

Source

UriReference::authority

fn UriReference::authority(self : UriReference) -> Authority?

Source

UriReference::fragment

fn UriReference::fragment(self : UriReference) -> String?

Encoded fragment text, preserving absent versus present-empty.

Source

UriReference::identity

fn UriReference::identity(self : UriReference) -> String

Syntax-based identity. Relative rootless dot segments need a base first.

Source

UriReference::is_absolute

fn UriReference::is_absolute(self : UriReference) -> Bool

Source

UriReference::parse

fn UriReference::parse(text : String, limits? : @moonrockz/openrpc/json.Limits) -> Result[UriReference, @moonrockz/openrpc/json.Diagnostic]

Source

UriReference::path

fn UriReference::path(self : UriReference) -> String

Source

UriReference::query

fn UriReference::query(self : UriReference) -> String?

Source

UriReference::resolve

fn UriReference::resolve(self : UriReference, base : UriReference, limits? : @moonrockz/openrpc/json.Limits) -> Result[UriReference, @moonrockz/openrpc/json.Diagnostic]

Strict RFC3986 section5.2 resolution. Neither value's original text changes.

Source

UriReference::scheme

fn UriReference::scheme(self : UriReference) -> String?

Source

UriReference::text

fn UriReference::text(self : UriReference) -> String

Source

UriReference::to_repr

fn UriReference::to_repr(UriReference) -> @moonbitlang/core/debug.Repr

Source

UriReference::without_fragment

fn UriReference::without_fragment(self : UriReference) -> UriReference

Source

Values

schema_scope

fn schema_scope(id : UriReference, scope : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> UriReference?

The scope in effect below a schema whose $id is id, given the enclosing scope. Without an absolute base, a relative identifier gives a relative scope: fragment-only references resolve within the location the index bound to it, and other references report MissingBaseUri.

Source