schema_salad.ref_resolver
Classes
A Dict where all keys are normalized using the provided function. |
|
Functions
|
|
|
|
Convert ruamel.yaml exception to our type. |
|
|
Module Contents
- schema_salad.ref_resolver.file_uri(path, split_frag=False)
- Parameters:
path (str)
split_frag (bool)
- Return type:
str
- schema_salad.ref_resolver.uri_file_path(url)
- Parameters:
url (str)
- Return type:
str
- schema_salad.ref_resolver.to_validation_exception(e)
Convert ruamel.yaml exception to our type.
- Parameters:
e (ruamel.yaml.error.MarkedYAMLError)
- Return type:
- class schema_salad.ref_resolver.NormDict(normalize=str)
Bases:
digraph inheritance5b4caf496b { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "NormDict" [URL="#schema_salad.ref_resolver.NormDict",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Dict where all keys are normalized using the provided function."]; }dict
[str
,Union
[ruamel.yaml.comments.CommentedMap
,ruamel.yaml.comments.CommentedSeq
,str
,None
]]A Dict where all keys are normalized using the provided function.
- Parameters:
normalize (Callable[[str], str])
- normalize
- __eq__(other)
Return self==value.
- Parameters:
other (Any)
- Return type:
bool
- __getitem__(key)
Return self[key].
- Parameters:
key (Any)
- Return type:
Any
- __setitem__(key, value)
Set self[key] to value.
- Parameters:
key (Any)
value (Any)
- Return type:
Any
- __delitem__(key)
Delete self[key].
- Parameters:
key (Any)
- Return type:
Any
- __contains__(key)
True if the dictionary has the specified key, else False.
- Parameters:
key (Any)
- Return type:
bool
- __del__()
- Return type:
None
- class schema_salad.ref_resolver.Loader(ctx, schemagraph=None, foreign_properties=None, idx=None, cache=None, session=None, fetcher_constructor=None, skip_schemas=None, url_fields=None, allow_attachments=None, doc_cache=True, salad_version=None)
- Parameters:
ctx (schema_salad.utils.ContextType)
schemagraph (Optional[rdflib.graph.Graph])
foreign_properties (Optional[set[str]])
idx (Optional[schema_salad.utils.IdxType])
cache (Optional[schema_salad.utils.CacheType])
session (Optional[requests.sessions.Session])
fetcher_constructor (Optional[schema_salad.utils.FetcherCallableType])
skip_schemas (Optional[bool])
url_fields (Optional[set[str]])
allow_attachments (Optional[schema_salad.utils.AttachmentsType])
doc_cache (Union[str, bool])
salad_version (Optional[str])
- idx: schema_salad.utils.IdxType
- ctx: schema_salad.utils.ContextType
- graph
- foreign_properties
- cache
- skip_schemas
- fetcher_constructor
- fetcher
- fetch_text
- check_exists
- url_fields: set[str]
- scoped_ref_fields: dict[str, int]
- vocab_fields: set[str]
- identifiers: list[str] = []
- identity_links: set[str]
- standalone: set[str] | None = None
- nolinkcheck: set[str]
- vocab: dict[str, str]
- rvocab: dict[str, str]
- idmap: dict[str, str]
- mapPredicate: dict[str, str]
- type_dsl_fields: set[str]
- subscopes: dict[str, str]
- secondaryFile_dsl_fields: set[str]
- allow_attachments
- expand_url(url, base_url, scoped_id=False, vocab_term=False, scoped_ref=None)
- Parameters:
url (str)
base_url (str)
scoped_id (bool)
vocab_term (bool)
scoped_ref (Optional[int])
- Return type:
str
- add_namespaces(ns)
Add the given namespace to our vocab list.
- Parameters:
ns (dict[str, str])
- Return type:
None
- add_schemas(ns, base_url)
Fetch exernal schemas and add them to the graph.
- Parameters:
ns (Union[list[str], str])
base_url (str)
- Return type:
None
- add_context(newcontext)
- Parameters:
newcontext (schema_salad.utils.ContextType)
- Return type:
None
- resolve_ref(ref, base_url=None, checklinks=True, strict_foreign_properties=False, content_types=None)
- Parameters:
ref (schema_salad.utils.ResolveType)
base_url (Optional[str])
checklinks (bool)
strict_foreign_properties (bool)
content_types (Optional[list[str]])
- Return type:
schema_salad.utils.ResolvedRefType
- resolve_all(document, base_url, file_base=None, checklinks=True, strict_foreign_properties=False)
- Parameters:
document (schema_salad.utils.ResolveType)
base_url (str)
file_base (Optional[str])
checklinks (bool)
strict_foreign_properties (bool)
- Return type:
schema_salad.utils.ResolvedRefType
- fetch(url, inject_ids=True, content_types=None)
- Parameters:
url (str)
inject_ids (bool)
content_types (Optional[list[str]])
- Return type:
schema_salad.utils.IdxResultType
- validate_scoped(field, link, docid)
- Parameters:
field (str)
link (str)
docid (str)
- Return type:
str
- validate_link(field, link, docid, all_doc_ids)
- Parameters:
field (str)
link (Union[str, ruamel.yaml.comments.CommentedSeq, ruamel.yaml.comments.CommentedMap])
docid (str)
all_doc_ids (dict[str, str])
- Return type:
Union[str, ruamel.yaml.comments.CommentedSeq, ruamel.yaml.comments.CommentedMap]
- getid(d)
- Parameters:
d (Any)
- Return type:
Optional[str]
- validate_links(document, base_url, all_doc_ids, strict_foreign_properties=False)
- Parameters:
document (schema_salad.utils.ResolveType)
base_url (str)
all_doc_ids (dict[str, str])
strict_foreign_properties (bool)
- Return type:
None