moonrockz/openrpc/reference
Types
Authority
pub struct Authority {
raw : String
userinfo : String?
host : Host
port : String?
} derive(@moonbitlang/core/debug.Debug)Authority::host
fn Authority::host(self : Authority) -> HostAuthority::port
fn Authority::port(self : Authority) -> String?Port is an exact digit token. Generic URI syntax imposes no transport range.
Authority::text
fn Authority::text(self : Authority) -> StringAuthority::to_repr
fn Authority::to_repr(Authority) -> @moonbitlang/core/debug.ReprAuthority::userinfo
fn Authority::userinfo(self : Authority) -> String?Host
pub enum Host {
RegisteredName(String)
Ipv4(String)
Ipv6(String)
IpvFuture(String)
} derive(@moonbitlang/core/debug.Debug)Host::to_repr
fn Host::to_repr(Host) -> @moonbitlang/core/debug.ReprJsonPointer
pub struct JsonPointer {
// private fields
} derive(@moonbitlang/core/debug.Debug)JsonPointer::from_tokens
fn JsonPointer::from_tokens(parts : Array[String], limits? : @moonrockz/openrpc/json.Limits) -> Result[JsonPointer, @moonrockz/openrpc/json.Diagnostic]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.
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]JsonPointer::to_repr
fn JsonPointer::to_repr(JsonPointer) -> @moonbitlang/core/debug.ReprJsonPointer::to_string
fn JsonPointer::to_string(self : JsonPointer) -> StringJsonPointer::tokens
fn JsonPointer::tokens(self : JsonPointer) -> Array[String]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.
Location::identity
fn Location::identity(self : Location) -> StringNormalized resource identity plus pointer; equal for every access path.
Location::pointer
fn Location::pointer(self : Location) -> JsonPointerLocation::resource
fn Location::resource(self : Location) -> UriReference?Location::target
fn Location::target(self : Location) -> @moonrockz/openrpc/json.ValueLocation::to_repr
fn Location::to_repr(Location) -> @moonbitlang/core/debug.ReprReference
pub struct Reference {
uri : UriReference
fragment : ReferenceFragment
} derive(@moonbitlang/core/debug.Debug)Reference::fragment
fn Reference::fragment(self : Reference) -> ReferenceFragmentReference::from_uri
fn Reference::from_uri(uri : UriReference, limits? : @moonrockz/openrpc/json.Limits) -> Result[Reference, @moonrockz/openrpc/json.Diagnostic]Reference::local_pointer
fn Reference::local_pointer(self : Reference) -> JsonPointer?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.
Reference::resolve
fn Reference::resolve(self : Reference, base : UriReference, limits? : @moonrockz/openrpc/json.Limits) -> Result[Reference, @moonrockz/openrpc/json.Diagnostic]Reference::text
fn Reference::text(self : Reference) -> StringReference::to_repr
fn Reference::to_repr(Reference) -> @moonbitlang/core/debug.ReprReference::uri
fn Reference::uri(self : Reference) -> UriReferenceReferenceFragment
pub enum ReferenceFragment {
WholeResource
PointerFragment(JsonPointer)
IdentifierFragment(String)
} derive(@moonbitlang/core/debug.Debug)ReferenceFragment::to_repr
fn ReferenceFragment::to_repr(ReferenceFragment) -> @moonbitlang/core/debug.ReprReferenceStep
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.
ReferenceStep::reference
fn ReferenceStep::reference(self : ReferenceStep) -> ReferenceReferenceStep::resolved
fn ReferenceStep::resolved(self : ReferenceStep) -> UriReference?ReferenceStep::site
fn ReferenceStep::site(self : ReferenceStep) -> Location?ReferenceStep::to_repr
fn ReferenceStep::to_repr(ReferenceStep) -> @moonbitlang/core/debug.ReprResolution
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.
Resolution::chain
fn Resolution::chain(self : Resolution) -> Array[ReferenceStep]Resolution::complete
fn Resolution::complete(self : Resolution) -> BoolResolution::diagnostics
fn Resolution::diagnostics(self : Resolution) -> Array[@moonrockz/openrpc/json.Diagnostic]Resolution::target
fn Resolution::target(self : Resolution) -> Location?Resolution::to_repr
fn Resolution::to_repr(Resolution) -> @moonbitlang/core/debug.ReprResource
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.
Resource::aliases
fn Resource::aliases(self : Resource) -> Array[UriReference]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]Resource::schema_roots
fn Resource::schema_roots(self : Resource) -> Array[JsonPointer]Locations whose values are declared draft-07 schema roots.
Resource::to_repr
fn Resource::to_repr(Resource) -> @moonbitlang/core/debug.ReprResource::uri
fn Resource::uri(self : Resource) -> UriReferenceResource::value
fn Resource::value(self : Resource) -> @moonrockz/openrpc/json.ValueResourceSet
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.
ResourceSet::empty
fn ResourceSet::empty() -> ResourceSetResourceSet::follow
fn ResourceSet::follow(self : ResourceSet, reference : Reference, next : (Location) -> Reference?, base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> ResolutionFollow 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.
ResourceSet::get
fn ResourceSet::get(self : ResourceSet, uri : UriReference) -> Resource?The resource registered under the fragment-free identity of uri.
ResourceSet::new
fn ResourceSet::new(resources : Array[Resource], root_base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> Result[ResourceSet, @moonrockz/openrpc/json.Diagnostic]ResourceSet::resolve
fn ResourceSet::resolve(self : ResourceSet, reference : Reference, base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> ResolutionResolve one reference against the explicit resources. A relative reference
uses base, else the set's root base. Nothing is fetched or executed.
ResourceSet::resources
fn ResourceSet::resources(self : ResourceSet) -> Array[Resource]ResourceSet::root_base
fn ResourceSet::root_base(self : ResourceSet) -> UriReference?ResourceSet::to_repr
fn ResourceSet::to_repr(ResourceSet) -> @moonbitlang/core/debug.ReprSchemaIndex
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.
SchemaIndex::complete
fn SchemaIndex::complete(self : SchemaIndex) -> BoolFalse when identifiers could not all be indexed: missing bases, undefined fragment forms or exhausted limits.
SchemaIndex::diagnostics
fn SchemaIndex::diagnostics(self : SchemaIndex) -> Array[@moonrockz/openrpc/json.Diagnostic]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.
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.
SchemaIndex::new
fn SchemaIndex::new(resources : ResourceSet, input? : @moonrockz/openrpc/json.Value?, input_base? : UriReference?, input_roots? : Array[JsonPointer], limits? : @moonrockz/openrpc/json.Limits) -> SchemaIndexSchemaIndex::resolve
fn SchemaIndex::resolve(self : SchemaIndex, reference : Reference, base? : UriReference?, limits? : @moonrockz/openrpc/json.Limits) -> ResolutionResolve 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.
SchemaIndex::resources
fn SchemaIndex::resources(self : SchemaIndex) -> ResourceSetSchemaIndex::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.
SchemaIndex::to_repr
fn SchemaIndex::to_repr(SchemaIndex) -> @moonbitlang/core/debug.ReprUriReference
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.
UriReference::authority
fn UriReference::authority(self : UriReference) -> Authority?UriReference::fragment
fn UriReference::fragment(self : UriReference) -> String?Encoded fragment text, preserving absent versus present-empty.
UriReference::identity
fn UriReference::identity(self : UriReference) -> StringSyntax-based identity. Relative rootless dot segments need a base first.
UriReference::is_absolute
fn UriReference::is_absolute(self : UriReference) -> BoolUriReference::parse
fn UriReference::parse(text : String, limits? : @moonrockz/openrpc/json.Limits) -> Result[UriReference, @moonrockz/openrpc/json.Diagnostic]UriReference::path
fn UriReference::path(self : UriReference) -> StringUriReference::query
fn UriReference::query(self : UriReference) -> String?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.
UriReference::scheme
fn UriReference::scheme(self : UriReference) -> String?UriReference::text
fn UriReference::text(self : UriReference) -> StringUriReference::to_repr
fn UriReference::to_repr(UriReference) -> @moonbitlang/core/debug.ReprUriReference::without_fragment
fn UriReference::without_fragment(self : UriReference) -> UriReferenceValues
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.