Schema Salad
Salad is a schema language for describing JSON or YAML structured linked data documents. Salad schema describes rules for preprocessing, structural validation, and hyperlink checking for documents described by a Salad schema. Salad supports rich data modeling with inheritance, template specialization, object identifiers, object references, documentation generation, code generation, and transformation to RDF. Salad provides a bridge between document and record oriented data modeling and the Semantic Web.
The Schema Salad library is Python 3.8+ only.
Installation
pip3 install schema_salad
If you intend to use the schema-salad-tool –codegen=python feature, please include the [pycodegen] extra:
pip3 install schema_salad[pycodegen]
To install from source:
git clone https://github.com/common-workflow-language/schema_salad
cd schema_salad
pip3 install .
# or pip3 install .[pycodegen] if needed
Commands
Schema salad can be used as a command line tool or imported as a Python module:
$ schema-salad-tool
usage: schema-salad-tool [-h] [--rdf-serializer RDF_SERIALIZER] [--skip-schemas]
[--strict-foreign-properties] [--print-jsonld-context]
[--print-rdfs] [--print-avro] [--print-rdf] [--print-pre]
[--print-index] [--print-metadata] [--print-inheritance-dot]
[--print-fieldrefs-dot] [--codegen language] [--codegen-target CODEGEN_TARGET]
[--codegen-examples directory] [--codegen-package dotted.package]
[--codegen-copyright copyright_string] [--print-oneline]
[--print-doc] [--strict | --non-strict]
[--verbose | --quiet | --debug] [--only ONLY] [--redirect REDIRECT]
[--brand BRAND] [--brandlink BRANDLINK] [--brandstyle BRANDSTYLE]
[--brandinverse] [--primtype PRIMTYPE] [--version]
[schema] [document]
$ python
>>> import schema_salad
Validate a schema:
$ schema-salad-tool myschema.yml
Validate a document using a schema:
$ schema-salad-tool myschema.yml mydocument.yml
Generate HTML documentation:
$ schema-salad-tool --print-doc myschema.yml > myschema.html
$ # or
$ schema-salad-doc myschema.yml > myschema.html
Get JSON-LD context:
$ schema-salad-tool --print-jsonld-context myschema.yml mydocument.yml
Convert a document to JSON-LD:
$ schema-salad-tool --print-pre myschema.yml mydocument.yml > mydocument.jsonld
Generate Python classes for loading/generating documents described by the schema (Requires the [pycodegen] extra):
$ schema-salad-tool --codegen=python myschema.yml > myschema.py
Display inheritance relationship between classes as a graphviz ‘dot’ file and render as SVG:
$ schema-salad-tool --print-inheritance-dot myschema.yml | dot -Tsvg > myschema.svg
Codegen Examples
The examples in the tables below are helpful to see how to use the output of schema-salad-tool –codegen in different languages for loading and/or creating/editing/saving objects.
First set of examples is using the CWL v1.2 schema:
Language |
Repository |
Serialization Example | Deserialization Example |
|
---|---|---|---|
Python |
|||
Java |
(Not yet implemented) |
||
TypeScript |
|||
.Net |
|||
C++ |
|||
D |
Second set of examples is for the Galaxy Workflow Format 2 schema:
Language |
Path |
---|---|
Python |
https://github.com/galaxyproject/gxformat2/blob/master/gxformat2/schema/v19_09.py |
Java |
|
TypeScript |
https://github.com/galaxyproject/gxformat2/tree/master/typescript |
Quick Start
Let’s say you have a ‘basket’ record that can contain items measured either by weight or by count. Here’s an example:
basket:
- product: bananas
price: 0.39
per: pound
weight: 1
- product: cucumbers
price: 0.79
per: item
count: 3
We want to validate that all the expected fields are present, the measurement is known, and that “count” cannot be a fractional value. Here is an example schema to do that:
- name: Product
doc: |
The base type for a product. This is an abstract type, so it
can't be used directly, but can be used to define other types.
type: record
abstract: true
fields:
product: string
price: float
- name: ByWeight
doc: |
A product, sold by weight. Products may be sold by pound or by
kilogram. Weights may be fractional.
type: record
extends: Product
fields:
per:
type:
type: enum
symbols:
- pound
- kilogram
jsonldPredicate: '#per'
weight: float
- name: ByCount
doc: |
A product, sold by count. The count must be a integer value.
type: record
extends: Product
fields:
per:
type:
type: enum
symbols:
- item
jsonldPredicate: '#per'
count: int
- name: Basket
doc: |
A basket of products. The 'documentRoot' field indicates it is a
valid starting point for a document. The 'basket' field will
validate subtypes of 'Product' (ByWeight and ByCount).
type: record
documentRoot: true
fields:
basket:
type:
type: array
items: Product
You can check the schema and document in schema_salad/tests/basket_schema.yml and schema_salad/tests/basket.yml:
$ schema-salad-tool basket_schema.yml basket.yml
Document `basket.yml` is valid
Documentation
See the specification and the metaschema (salad schema for itself). For an example application of Schema Salad see the Common Workflow Language.
Rationale
The JSON data model is an popular way to represent structured data. It is attractive because of it’s relative simplicity and is a natural fit with the standard types of many programming languages. However, this simplicity comes at the cost that basic JSON lacks expressive features useful for working with complex data structures and document formats, such as schemas, object references, and namespaces.
JSON-LD is a W3C standard providing a way to describe how to interpret a JSON document as Linked Data by means of a “context”. JSON-LD provides a powerful solution for representing object references and namespaces in JSON based on standard web URIs, but is not itself a schema language. Without a schema providing a well defined structure, it is difficult to process an arbitrary JSON-LD document as idiomatic JSON because there are many ways to express the same data that are logically equivalent but structurally distinct.
Several schema languages exist for describing and validating JSON data, such as JSON Schema and Apache Avro data serialization system, however none understand linked data. As a result, to fully take advantage of JSON-LD to build the next generation of linked data applications, one must maintain separate JSON schema, JSON-LD context, RDF schema, and human documentation, despite significant overlap of content and obvious need for these documents to stay synchronized.
Schema Salad is designed to address this gap. It provides a schema language and processing rules for describing structured JSON content permitting URI resolution and strict document validation. The schema language supports linked data through annotations that describe the linked data interpretation of the content, enables generation of JSON-LD context and RDF schema, and production of RDF triples by applying the JSON-LD context. The schema language also provides for robust support of inline documentation.
Command Line Options
schema-salad-tool
usage: schema-salad-tool [-h] [--rdf-serializer RDF_SERIALIZER]
[--skip-schemas] [--strict-foreign-properties]
[--print-jsonld-context] [--print-rdfs]
[--print-avro] [--print-rdf] [--print-pre]
[--print-index] [--print-metadata]
[--print-inheritance-dot] [--print-fieldrefs-dot]
[--codegen language]
[--codegen-target CODEGEN_TARGET]
[--codegen-examples directory]
[--codegen-package dotted.package]
[--codegen-copyright copyright_string]
[--codegen-spdx-copyright-text spdx_copyright_text [spdx_copyright_text ...]]
[--codegen-spdx-license-identifier spdx_license_identifier]
[--codegen-parser-info parser_info] [--print-oneline]
[--print-doc] [--strict | --non-strict]
[--verbose | --quiet | --debug] [--only ONLY]
[--redirect REDIRECT] [--brand BRAND]
[--brandlink BRANDLINK] [--brandstyle BRANDSTYLE]
[--brandinverse] [--primtype PRIMTYPE] [--version]
[schema] [document ...]
- schema
- document
- -h, --help
show this help message and exit
- --rdf-serializer <rdf_serializer>
Output RDF serialization format used by –print-rdf(one of turtle (default), n3, nt, xml)
- --skip-schemas
If specified, ignore $schemas sections.
- --strict-foreign-properties
Strict checking of foreign properties
- --print-jsonld-context
Print JSON-LD context for schema
- --print-rdfs
Print RDF schema
- --print-avro
Print Avro schema
- --print-rdf
Print corresponding RDF graph for document
- --print-pre
Print document after preprocessing
- --print-index
Print node index
- --print-metadata
Print document metadata
- --print-inheritance-dot
Print graphviz file of inheritance
- --print-fieldrefs-dot
Print graphviz file of field refs
- --codegen <language>
Generate classes in target language, currently supported: python, java, typescript, dotnet, cpp, dlang
- --codegen-target <codegen_target>
Defaults to sys.stdout for Python/C++/Dlang and ./ for Java/TypeScript/.Net
- --codegen-examples <directory>
Directory of example documents for test case generation (Java/TypeScript/.Net/Dlang only).
- --codegen-package <dotted.package>
Optional override of the package name which is other derived from the base URL (Java/TypeScript/.Net/Dlang only).
- --codegen-copyright <copyright_string>
Optional copyright of the input schema.
- --codegen-spdx-copyright-text <spdx_copyright_text>
List of copyright text. Each entry will show up as ‘SPDX-FileCopyrightText: …’ (Currently c++ only)
- --codegen-spdx-license-identifier <spdx_license_identifier>
Optional spdx license identifier, e.g.: GPL-3.0-only (Currently c++ only)
- --codegen-parser-info <parser_info>
Optional parser name which is accessible via resulted parser API (Python and Dlang only)
- --print-oneline
Print each error message in oneline
- --print-doc
Print HTML schema documentation page
- --strict
Strict validation (unrecognized or out of place fields are error)
- --non-strict
Lenient validation (ignore unrecognized fields)
- --verbose
Default logging
- --quiet
Only print warnings and errors.
- --debug
Print even more logging
- --only <only>
Use with –print-doc, document only listed types
- --redirect <redirect>
Use with –print-doc, override default link for type
- --brand <brand>
Use with –print-doc, set the ‘brand’ text in nav bar
- --brandlink <brandlink>
Use with –print-doc, set the link for ‘brand’ in nav bar
- --brandstyle <brandstyle>
Use with –print-doc, HTML code to link to an external style sheet
- --brandinverse
Use with –print-doc
- --primtype <primtype>
Use with –print-doc, link to use for primitive types (string, int etc)
- --version, -v
Print version
schema-salad-doc
usage: schema-salad-doc [-h] [--only ONLY] [--redirect REDIRECT]
[--brand BRAND] [--brandlink BRANDLINK]
[--brandstyle BRANDSTYLE] [--brandinverse]
[--primtype PRIMTYPE] [--debug]
schema
- schema
- -h, --help
show this help message and exit
- --only <only>
- --redirect <redirect>
- --brand <brand>
- --brandlink <brandlink>
- --brandstyle <brandstyle>
- --brandinverse
- --primtype <primtype>
- --debug
How to add new types to the local Typeshed
If when running make mypy
you receive errors about modules that can’t be
found you may need to add type stubs for new modules to the mypy-stubs/
directory.
stubgen -o mypy-stubs module_name
make mypy
Note: the module name is not always the name of the PyPI package
(CacheControl
vs cachecontrol
).
Stubs are just that, you will still need to annotate whichever functions you call.
Oftentimes it is simpler to comment out imports in the .pyi
stubs that are
not needed yet. The goal is represent the public API, or at least the part we
use.
API Reference
This page contains auto-generated API reference documentation [1].
schema_salad
A schema language for describing JSON or YAML structured linked data documents.
Subpackages
schema_salad.avro
Submodules
schema_salad.avro.schema
Contains the Schema classes.
- A schema may be one of:
A record, mapping field names to field value data; An enum, containing one of a small set of symbols; An array of values, all of the same schema; A map of values, all of the same schema; A union of other schemas; A unicode string; A 32-bit signed int; A 64-bit signed long; A 32-bit floating-point float; A 64-bit floating-point double; A boolean; or Null.
Module Contents
Classes
Base class for all Schema classes. |
|
Class to describe Avro name. |
|
Track name set and default namespace during parsing. |
|
Named Schemas specified in NAMED_TYPES. |
|
Valid primitive types are in PRIMITIVE_TYPES. |
|
Named Schemas specified in NAMED_TYPES. |
|
Avro array schema class. |
|
Avro map schema class. |
|
Avro named map schema class. |
|
Avro union schema class. |
|
Avro named union schema class. |
|
Named Schemas specified in NAMED_TYPES. |
Functions
|
Retrieve the non-reserved properties from a dictionary of properties. |
|
Build Avro Schema from data parsed out of JSON string. |
|
Check if a new type specification is compatible with an existing type spec. |
Attributes
- schema_salad.avro.schema.PRIMITIVE_TYPES = ('null', 'boolean', 'string', 'int', 'long', 'float', 'double')
- schema_salad.avro.schema.NAMED_TYPES = ('enum', 'record')
- schema_salad.avro.schema.VALID_TYPES
- schema_salad.avro.schema.SCHEMA_RESERVED_PROPS = ('type', 'name', 'namespace', 'fields', 'items', 'names', 'symbols', 'values', 'doc')
- schema_salad.avro.schema.JsonDataType
- schema_salad.avro.schema.AtomicPropType
- schema_salad.avro.schema.PropType
- schema_salad.avro.schema.PropsType
- schema_salad.avro.schema.FIELD_RESERVED_PROPS = ('default', 'name', 'doc', 'order', 'type')
- schema_salad.avro.schema.VALID_FIELD_SORT_ORDERS = ('ascending', 'descending', 'ignore')
- exception schema_salad.avro.schema.AvroException(msg, sl=None, children=None, bullet_for_children='')
Bases:
digraph inheritance9342b6adff { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AvroException" [URL="#schema_salad.avro.schema.AvroException",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"]; "SchemaException" -> "AvroException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaException" [URL="index.html#schema_salad.exceptions.SchemaException",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="Indicates error with the provided schema definition."]; "SchemaSaladException" -> "SchemaException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaSaladException" [URL="index.html#schema_salad.exceptions.SchemaSaladException",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="Base class for all schema-salad exceptions."]; }schema_salad.exceptions.SchemaException
Indicates error with the provided schema definition.
- Parameters:
msg (str)
sl (Optional[schema_salad.sourceline.SourceLine])
children (Optional[Sequence[SchemaSaladException]])
bullet_for_children (str)
- exception schema_salad.avro.schema.SchemaParseException(msg, sl=None, children=None, bullet_for_children='')
Bases:
digraph inheritanced169f71d5f { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AvroException" [URL="#schema_salad.avro.schema.AvroException",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"]; "SchemaException" -> "AvroException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaException" [URL="index.html#schema_salad.exceptions.SchemaException",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="Indicates error with the provided schema definition."]; "SchemaSaladException" -> "SchemaException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaParseException" [URL="#schema_salad.avro.schema.SchemaParseException",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"]; "AvroException" -> "SchemaParseException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaSaladException" [URL="index.html#schema_salad.exceptions.SchemaSaladException",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="Base class for all schema-salad exceptions."]; }AvroException
Indicates error with the provided schema definition.
- Parameters:
msg (str)
sl (Optional[schema_salad.sourceline.SourceLine])
children (Optional[Sequence[SchemaSaladException]])
bullet_for_children (str)
- class schema_salad.avro.schema.Schema(atype, other_props=None)
Base class for all Schema classes.
- Parameters:
atype (str)
other_props (Optional[PropsType])
- property props: PropsType
- Return type:
PropsType
- class schema_salad.avro.schema.Name(name_attr=None, space_attr=None, default_space=None)
Class to describe Avro name.
- class schema_salad.avro.schema.Names(default_namespace=None)
Track name set and default namespace during parsing.
- Parameters:
default_namespace (Optional[str])
- has_name(name_attr, space_attr)
- get_name(name_attr, space_attr)
Fetch the stored schema for the given namespace.
- Parameters:
- Return type:
Optional[NamedSchema]
- add_name(name_attr, space_attr, new_schema)
Add a new schema object to the name set.
- Parameters:
name_attr (str) – name value read in schema
space_attr (Optional[str]) – namespace value read in schema.
new_schema (NamedSchema)
- Returns:
the Name that was just added.
- Return type:
- class schema_salad.avro.schema.NamedSchema(atype, name, namespace=None, names=None, other_props=None)
Bases:
digraph inheritancecfa20f43d8 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "NamedSchema" [URL="#schema_salad.avro.schema.NamedSchema",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="Named Schemas specified in NAMED_TYPES."]; "Schema" -> "NamedSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }Schema
Named Schemas specified in NAMED_TYPES.
- Parameters:
- class schema_salad.avro.schema.Field(atype, name, has_default, default=None, order=None, names=None, doc=None, other_props=None)
- Parameters:
- class schema_salad.avro.schema.PrimitiveSchema(atype, other_props=None)
Bases:
digraph inheritance309a015514 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "PrimitiveSchema" [URL="#schema_salad.avro.schema.PrimitiveSchema",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="Valid primitive types are in PRIMITIVE_TYPES."]; "Schema" -> "PrimitiveSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }Schema
Valid primitive types are in PRIMITIVE_TYPES.
- Parameters:
atype (str)
other_props (Optional[PropsType])
- class schema_salad.avro.schema.EnumSchema(name, namespace, symbols, names=None, doc=None, other_props=None)
Bases:
digraph inheritance881b940a13 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "EnumSchema" [URL="#schema_salad.avro.schema.EnumSchema",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"]; "NamedSchema" -> "EnumSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedSchema" [URL="#schema_salad.avro.schema.NamedSchema",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="Named Schemas specified in NAMED_TYPES."]; "Schema" -> "NamedSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }NamedSchema
Named Schemas specified in NAMED_TYPES.
- Parameters:
- class schema_salad.avro.schema.ArraySchema(items, names, other_props=None)
Bases:
digraph inheritance34e8329cb5 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ArraySchema" [URL="#schema_salad.avro.schema.ArraySchema",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="Avro array schema class."]; "Schema" -> "ArraySchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }Schema
Avro array schema class.
- Parameters:
items (JsonDataType)
names (Names)
other_props (Optional[PropsType])
- class schema_salad.avro.schema.MapSchema(values, names, other_props=None)
Bases:
digraph inheritanceec91ade057 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "MapSchema" [URL="#schema_salad.avro.schema.MapSchema",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="Avro map schema class."]; "Schema" -> "MapSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }Schema
Avro map schema class.
- Parameters:
values (JsonDataType)
names (Names)
other_props (Optional[PropsType])
- class schema_salad.avro.schema.NamedMapSchema(values, names, name, namespace=None, doc=None, other_props=None)
Bases:
digraph inheritance58ad0c3ab1 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "NamedMapSchema" [URL="#schema_salad.avro.schema.NamedMapSchema",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="Avro named map schema class."]; "NamedSchema" -> "NamedMapSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedSchema" [URL="#schema_salad.avro.schema.NamedSchema",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="Named Schemas specified in NAMED_TYPES."]; "Schema" -> "NamedSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }NamedSchema
Avro named map schema class.
- Parameters:
- class schema_salad.avro.schema.UnionSchema(schemas, names)
Bases:
digraph inheritance3e42bb20c3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; "UnionSchema" [URL="#schema_salad.avro.schema.UnionSchema",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="Avro union schema class."]; "Schema" -> "UnionSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Schema
Avro union schema class.
- Parameters:
schemas (List[JsonDataType])
names (Names)
- class schema_salad.avro.schema.NamedUnionSchema(schemas, names, name, namespace=None, doc=None)
Bases:
digraph inheritancefc25935886 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "NamedSchema" [URL="#schema_salad.avro.schema.NamedSchema",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="Named Schemas specified in NAMED_TYPES."]; "Schema" -> "NamedSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedUnionSchema" [URL="#schema_salad.avro.schema.NamedUnionSchema",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="Avro named union schema class."]; "NamedSchema" -> "NamedUnionSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }NamedSchema
Avro named union schema class.
- Parameters:
- class schema_salad.avro.schema.RecordSchema(name, namespace, fields, names, schema_type='record', doc=None, other_props=None)
Bases:
digraph inheritance9f432fd7f3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "NamedSchema" [URL="#schema_salad.avro.schema.NamedSchema",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="Named Schemas specified in NAMED_TYPES."]; "Schema" -> "NamedSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RecordSchema" [URL="#schema_salad.avro.schema.RecordSchema",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"]; "NamedSchema" -> "RecordSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Schema" [URL="#schema_salad.avro.schema.Schema",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="Base class for all Schema classes."]; }NamedSchema
Named Schemas specified in NAMED_TYPES.
- Parameters:
- schema_salad.avro.schema.get_other_props(all_props, reserved_props)
Retrieve the non-reserved properties from a dictionary of properties.
- Parameters:
reserved_props (Tuple[str, Ellipsis]) – The set of reserved properties to exclude
all_props (PropsType)
- Return type:
Optional[PropsType]
- schema_salad.avro.schema.make_avsc_object(json_data, names=None)
Build Avro Schema from data parsed out of JSON string.
schema_salad.tests
Submodules
schema_salad.tests.conftest
Module Contents
Functions
Clear the schema_salad metaschema cache. |
- schema_salad.tests.conftest.isolated_cache()
Clear the schema_salad metaschema cache.
Auto-loaded (see autouse) fixture, loaded per test (function scope). Prevents issues when running multiple tests that load metaschemas multiple times or in parallel (pytest-parallel, pytest-xdist, etc).
- Return type:
None
schema_salad.tests.matcher
Module Contents
Classes
Raise AssertionError with a readable JSON diff when not __eq__(). |
Functions
|
- class schema_salad.tests.matcher.JsonDiffMatcher(expected)
Raise AssertionError with a readable JSON diff when not __eq__().
Used with assert_called_with() so it’s possible for a human to see the differences between expected and actual call arguments that include non-trivial data structures.
- Parameters:
expected (Any)
schema_salad.tests.test_avro_names
Avro related tests.
Module Contents
Functions
Confirm conversion of SALAD style names to avro. |
- schema_salad.tests.test_avro_names.test_avro_loading()
Confirm conversion of SALAD style names to avro.
- Return type:
None
schema_salad.tests.test_cg
Module Contents
Functions
|
|
Test shortname() function. |
|
Prep-parsed schema for testing. |
|
|
|
|
|
Attributes
- schema_salad.tests.test_cg.test_load()
- Return type:
None
- schema_salad.tests.test_cg.test_err()
- Return type:
None
- schema_salad.tests.test_cg.test_include()
- Return type:
None
- schema_salad.tests.test_cg.test_import()
- Return type:
None
- schema_salad.tests.test_cg.maxDiff
- schema_salad.tests.test_cg.test_import2()
- Return type:
None
- schema_salad.tests.test_cg.test_err2()
- Return type:
None
- schema_salad.tests.test_cg.test_idmap()
- Return type:
None
- schema_salad.tests.test_cg.test_idmap2()
- Return type:
None
- schema_salad.tests.test_cg.test_load_pt()
- Return type:
None
- schema_salad.tests.test_cg.test_shortname()
Test shortname() function.
- Return type:
None
- schema_salad.tests.test_cg.metaschema_pre()
Prep-parsed schema for testing.
- Return type:
Any
- schema_salad.tests.test_cg.test_load_metaschema(metaschema_pre)
- Parameters:
metaschema_pre (Any)
- Return type:
None
- schema_salad.tests.test_cg.test_load_by_yaml_metaschema(metaschema_pre)
- Parameters:
metaschema_pre (Any)
- Return type:
None
- schema_salad.tests.test_cg.test_load_cwlschema()
- Return type:
None
schema_salad.tests.test_cli_args
test different sets of command line arguments
Module Contents
Functions
- schema_salad.tests.test_cli_args.captured_output()
- Return type:
Iterator[Tuple[io.StringIO, io.StringIO]]
- schema_salad.tests.test_cli_args.test_version()
- Return type:
None
- schema_salad.tests.test_cli_args.test_empty_input()
- Return type:
None
schema_salad.tests.test_codegen_errors
Tests of helpful error messages.
Module Contents
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- schema_salad.tests.test_codegen_errors.test_error_message1(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message2(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message4(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message5(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message6(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message7(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message8(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message9(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message10(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message11(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.test_error_message15(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_codegen_errors.load_document_by_uri(tmp_path, path)
- Parameters:
tmp_path (pathlib.Path)
path (Union[str, pathlib.Path])
- Return type:
Any
- schema_salad.tests.test_codegen_errors.python_codegen(file_uri, target, parser_info=None, package=None)
- Parameters:
file_uri (str)
target (pathlib.Path)
parser_info (Optional[str])
package (Optional[str])
- Return type:
None
schema_salad.tests.test_cpp_codegen
Test C++ code generation.
Module Contents
Functions
|
End to end test of C++ generator using the CWL v1.0 schema. |
|
End to end test of C++ generator using small scenarios. |
|
End to end test of C++ generator checking for SPDX headers |
|
Help using the C++ code generation function. |
- schema_salad.tests.test_cpp_codegen.test_cwl_cpp_gen(tmp_path)
End to end test of C++ generator using the CWL v1.0 schema.
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_cpp_codegen.test_cwl_cpp_generations(tmp_path, filename)
End to end test of C++ generator using small scenarios.
- Parameters:
tmp_path (pathlib.Path)
filename (str)
- Return type:
None
- schema_salad.tests.test_cpp_codegen.test_cwl_cpp_generations_with_spdx(tmp_path)
End to end test of C++ generator checking for SPDX headers
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_cpp_codegen.cpp_codegen(file_uri, target, spdx_copyright_text=None, spdx_license_identifier=None)
Help using the C++ code generation function.
- Parameters:
file_uri (str)
target (pathlib.Path)
spdx_copyright_text (Optional[List[str]])
spdx_license_identifier (Optional[str])
- Return type:
None
schema_salad.tests.test_cwl11
Ensure codegen-produced parsers accept $schemas directives
run individually as py.test -k test_cwl11
Module Contents
Functions
|
|
|
|
|
secondaryFiles |
|
secondaryFiles |
|
Tabs in the file. |
Attributes
- schema_salad.tests.test_cwl11.test_dir_name = 'tests/'
- schema_salad.tests.test_cwl11.SchemaType
- schema_salad.tests.test_cwl11.cwl_v1_2_schema(tmp_path_factory)
- Parameters:
tmp_path_factory (_pytest.tmpdir.TempPathFactory)
- Return type:
Generator[SchemaType, None, None]
- schema_salad.tests.test_cwl11.load_cwl(cwl_v1_2_schema, src)
- schema_salad.tests.test_cwl11.test_secondaryFiles(cwl_v1_2_schema)
secondaryFiles
- Parameters:
cwl_v1_2_schema (SchemaType)
- Return type:
None
- schema_salad.tests.test_cwl11.test_outputBinding(cwl_v1_2_schema)
secondaryFiles
- Parameters:
cwl_v1_2_schema (SchemaType)
- Return type:
None
- schema_salad.tests.test_cwl11.test_yaml_tab_error(cwl_v1_2_schema)
Tabs in the file.
- Parameters:
cwl_v1_2_schema (SchemaType)
- Return type:
None
schema_salad.tests.test_dlang_codegen
Test D code generation.
Module Contents
Functions
|
End to end test of D generator using the CWL v1.0 schema. |
|
Help using the D code generation function. |
- schema_salad.tests.test_dlang_codegen.test_cwl_dlang_gen(tmp_path)
End to end test of D generator using the CWL v1.0 schema.
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_dlang_codegen.dlang_codegen(file_uri, target)
Help using the D code generation function.
- Parameters:
file_uri (str)
target (pathlib.Path)
- Return type:
None
schema_salad.tests.test_dotnet_codegen
Module Contents
Functions
|
|
|
|
|
|
|
|
|
Attributes
- schema_salad.tests.test_dotnet_codegen.test_cwl_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_dotnet_codegen.test_meta_schema_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_dotnet_codegen.test_class_field(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_dotnet_codegen.get_data_uri(resource_path)
- schema_salad.tests.test_dotnet_codegen.cwl_file_uri
- schema_salad.tests.test_dotnet_codegen.metaschema_file_uri
- schema_salad.tests.test_dotnet_codegen.dotnet_codegen(file_uri, target, examples=None)
- Parameters:
file_uri (str)
target (pathlib.Path)
examples (Optional[pathlib.Path])
- Return type:
None
schema_salad.tests.test_errors
Tests of helpful error messages.
Module Contents
Functions
Confirm helpful error message when $namespaces is the wrong type. |
|
|
Confirm warning message a namespace is used but not declared. |
|
Confirm no warning when relative id contains a colon but prefix doesn't look like a namespace. |
|
Confirm no warning when relative id contains a colon but prefix doesn't look like a namespace. |
|
Confirm no warning when relative id starts with a colon. |
Confirm helpful error message when $schemas is the wrong type. |
- schema_salad.tests.test_errors.test_errors()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message1()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message2()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message3()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message4()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message5()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message7()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message8()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message9()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message10()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message11()
- Return type:
None
- schema_salad.tests.test_errors.test_error_message15()
- Return type:
None
- schema_salad.tests.test_errors.test_errors_previously_defined_dict_key()
- Return type:
None
- schema_salad.tests.test_errors.test_bad_schema()
- Return type:
None
- schema_salad.tests.test_errors.test_bad_schema2()
- Return type:
None
- schema_salad.tests.test_errors.test_namespaces_type()
Confirm helpful error message when $namespaces is the wrong type.
- Return type:
None
- schema_salad.tests.test_errors.test_namespaces_undeclared(caplog)
Confirm warning message a namespace is used but not declared.
- Parameters:
caplog (pytest.LogCaptureFixture)
- Return type:
None
- schema_salad.tests.test_errors.test_not_a_namespace1(caplog)
Confirm no warning when relative id contains a colon but prefix doesn’t look like a namespace.
- Parameters:
caplog (pytest.LogCaptureFixture)
- Return type:
None
- schema_salad.tests.test_errors.test_not_a_namespace2(caplog)
Confirm no warning when relative id contains a colon but prefix doesn’t look like a namespace.
- Parameters:
caplog (pytest.LogCaptureFixture)
- Return type:
None
- schema_salad.tests.test_errors.test_not_a_namespace3(caplog)
Confirm no warning when relative id starts with a colon.
- Parameters:
caplog (pytest.LogCaptureFixture)
- Return type:
None
- schema_salad.tests.test_errors.test_schemas_type()
Confirm helpful error message when $schemas is the wrong type.
- Return type:
None
schema_salad.tests.test_examples
Test examples.
Module Contents
Functions
|
Test that bad $schemas refs don't stop parsing. |
|
Test that (bad) $schemas refs are properly skipped. |
Test --print-rdf. |
|
Test --print-rdf when document references unfetchable external schema. |
|
Test --print-pre only schema. |
|
Test --print-pre. |
|
Test --print-index only with a schema. |
|
Test --print-index. |
|
Test --print-metadata only for a schema. |
|
Test --print-metadata. |
|
Test schema-salad-doc when the 1st type has only a single doc line. |
|
Affirm that datetime objects can be serialized in makerdf(). |
|
Affirm that yaml_no_ts prevents the creation of datetime objects. |
|
Test that 'type: Any' can be used |
|
- schema_salad.tests.test_examples.test_schemas()
- Return type:
None
- schema_salad.tests.test_examples.test_bad_schemas(caplog)
Test that bad $schemas refs don’t stop parsing.
- Parameters:
caplog (pytest.LogCaptureFixture)
- Return type:
None
- schema_salad.tests.test_examples.test_skip_bad_schemas(caplog)
Test that (bad) $schemas refs are properly skipped.
- Parameters:
caplog (pytest.LogCaptureFixture)
- Return type:
None
- schema_salad.tests.test_examples.test_self_validate()
- Return type:
None
- schema_salad.tests.test_examples.test_print_rdf()
Test –print-rdf.
- Return type:
None
- schema_salad.tests.test_examples.test_print_rdf_invalid_external_ref()
Test –print-rdf when document references unfetchable external schema.
- Return type:
None
- schema_salad.tests.test_examples.test_print_pre_schema()
Test –print-pre only schema.
- Return type:
None
- schema_salad.tests.test_examples.test_print_pre()
Test –print-pre.
- Return type:
None
- schema_salad.tests.test_examples.test_print_schema_index()
Test –print-index only with a schema.
- Return type:
None
- schema_salad.tests.test_examples.test_print_index()
Test –print-index.
- Return type:
None
- schema_salad.tests.test_examples.test_print_schema_metadata()
Test –print-metadata only for a schema.
- Return type:
None
- schema_salad.tests.test_examples.test_print_metadata()
Test –print-metadata.
- Return type:
None
- schema_salad.tests.test_examples.test_schema_salad_doc_oneline_doc()
Test schema-salad-doc when the 1st type has only a single doc line.
- Return type:
None
- schema_salad.tests.test_examples.test_avro_regression()
- Return type:
None
- schema_salad.tests.test_examples.test_jsonld_ctx()
- Return type:
None
- schema_salad.tests.test_examples.test_idmap()
- Return type:
None
- schema_salad.tests.test_examples.test_scoped_ref()
- Return type:
None
- schema_salad.tests.test_examples.test_examples()
- Return type:
None
- schema_salad.tests.test_examples.test_yaml_float_test()
- Return type:
None
- schema_salad.tests.test_examples.test_typedsl_ref()
- Return type:
None
- schema_salad.tests.test_examples.test_nested_typedsl_ref()
- Return type:
None
- schema_salad.tests.test_examples.test_secondaryFile_dsl_ref()
- Return type:
None
- schema_salad.tests.test_examples.test_scoped_id()
- Return type:
None
- schema_salad.tests.test_examples.test_rdf_datetime()
Affirm that datetime objects can be serialized in makerdf().
- Return type:
None
- schema_salad.tests.test_examples.test_yaml_datetime()
Affirm that yaml_no_ts prevents the creation of datetime objects.
- Return type:
None
- schema_salad.tests.test_examples.test_subscoped_id()
- Return type:
None
- schema_salad.tests.test_examples.test_mixin()
- Return type:
None
- schema_salad.tests.test_examples.test_fragment()
- Return type:
None
- schema_salad.tests.test_examples.test_file_uri()
- Return type:
None
- schema_salad.tests.test_examples.test_sourceline()
- Return type:
None
- schema_salad.tests.test_examples.test_cmap()
- Return type:
None
- schema_salad.tests.test_examples.test_blank_node_id()
- Return type:
None
- schema_salad.tests.test_examples.test_can_use_Any()
Test that ‘type: Any’ can be used
- Return type:
None
- schema_salad.tests.test_examples.test_nullable_links()
- Return type:
None
schema_salad.tests.test_fetch
Module Contents
Classes
Fetch resources from URIs. |
|
Fetch resources from URIs. |
Functions
- class schema_salad.tests.test_fetch.testFetcher(cache, session)
Bases:
digraph inheritancecce3809c86 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Fetcher" [URL="index.html#schema_salad.fetcher.Fetcher",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="Fetch resources from URIs."]; "ABC" -> "Fetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "testFetcher" [URL="#schema_salad.tests.test_fetch.testFetcher",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"]; "Fetcher" -> "testFetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.fetcher.Fetcher
Fetch resources from URIs.
- Parameters:
cache (schema_salad.utils.CacheType)
session (Optional[requests.sessions.Session])
- fetch_text(url, content_types=None)
Retrieve the given resource as a string.
- class schema_salad.tests.test_fetch.CWLTestFetcher(cache, session)
Bases:
digraph inheritance2a94a1de47 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "CWLTestFetcher" [URL="#schema_salad.tests.test_fetch.CWLTestFetcher",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"]; "Fetcher" -> "CWLTestFetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Fetcher" [URL="index.html#schema_salad.fetcher.Fetcher",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="Fetch resources from URIs."]; "ABC" -> "Fetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.fetcher.Fetcher
Fetch resources from URIs.
- Parameters:
cache (schema_salad.utils.CacheType)
session (Optional[requests.sessions.Session])
- fetch_text(url, content_types=None)
Retrieve the given resource as a string.
- schema_salad.tests.test_fetch.test_fetcher()
- Return type:
None
- schema_salad.tests.test_fetch.test_cache()
- Return type:
None
schema_salad.tests.test_fp
Module Contents
Functions
|
- schema_salad.tests.test_fp.test_fp()
- Return type:
None
schema_salad.tests.test_java_codegen
Module Contents
Functions
|
|
|
|
|
- schema_salad.tests.test_java_codegen.test_cwl_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_java_codegen.test_meta_schema_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_java_codegen.java_codegen(file_uri, target, examples=None)
- Parameters:
file_uri (str)
target (pathlib.Path)
examples (Optional[pathlib.Path])
- Return type:
None
schema_salad.tests.test_makedoc
Test schema-salad-doc
.
(also known as schema-salad-tool --print-doc
)
For convenience, tests are checking exact strings. In the event of changes in the “mistune” package, makedoc.py, or other changes, feel free to modify the test strings as long as the new HTML renders the same way in typical browsers.
Likewise, if the schema-salad metaschema changes and it is missing one or more of the features tested below, then please copy those old features to a new file and update the affected tests to use those new file(s).
Module Contents
Functions
Test schema-salad-doc when types inherit and override values from parent types. |
|
|
Avoid error when calling fixture directly. |
Pytest Fixture of the rendered HTML for the metaschema schema. |
|
Fenced code contents are not interpreted as Markdown definitions and converted into erroneous HTML. |
|
|
Doc headers must have an id and section link. |
|
The special Table of Contents token must be replaced with a rendered table. |
|
Plan links should be treated as if they were wrapped in angle brackets. |
Raw HTML shouldn't get escaped. |
|
|
Hanging indents in Markdown lists don't lead to wordsmushing. |
Hanging indents are not required in Markdown lists. |
|
|
Catch all for changes in HTML output, please adjust if the changes are innocent. |
- schema_salad.tests.test_makedoc.test_schema_salad_inherit_docs()
Test schema-salad-doc when types inherit and override values from parent types.
- Return type:
None
- schema_salad.tests.test_makedoc.generate_doc(schema_data=None)
Avoid error when calling fixture directly.
- schema_salad.tests.test_makedoc.fixture_metaschema_doc()
Pytest Fixture of the rendered HTML for the metaschema schema.
- Return type:
- schema_salad.tests.test_makedoc.test_doc_fenced_code_contents_preserved()
Fenced code contents are not interpreted as Markdown definitions and converted into erroneous HTML.
An example of problem case is when a definition looks like a Markdown list (e.g.: a YAML array). It must not be converted into HTML contents with list tags. However, special characters (e.g.:
<
,>
) must still be escaped, otherwise they will not be correctly rendered within an HTML<pre><code>
block.- Return type:
None
- schema_salad.tests.test_makedoc.test_doc_headings_target_anchor(metaschema_doc)
Doc headers must have an id and section link.
- Parameters:
metaschema_doc (str)
- Return type:
None
- schema_salad.tests.test_makedoc.test_doc_render_table_of_contents(metaschema_doc)
The special Table of Contents token must be replaced with a rendered table.
- Parameters:
metaschema_doc (str)
- Return type:
None
- schema_salad.tests.test_makedoc.test_plain_links_autolinked(metaschema_doc)
Plan links should be treated as if they were wrapped in angle brackets.
- Parameters:
metaschema_doc (str)
- Return type:
None
- schema_salad.tests.test_makedoc.test_embedded_html_unescaped()
Raw HTML shouldn’t get escaped.
- Return type:
None
- schema_salad.tests.test_makedoc.test_multiline_list_entries_word_spacing(metaschema_doc)
Hanging indents in Markdown lists don’t lead to wordsmushing.
- Parameters:
metaschema_doc (str)
- Return type:
None
- schema_salad.tests.test_makedoc.test_multiline_list_entries_without_indention(metaschema_doc)
Hanging indents are not required in Markdown lists.
- Parameters:
metaschema_doc (str)
- Return type:
None
- schema_salad.tests.test_makedoc.test_detect_changes_in_html(metaschema_doc, tmp_path)
Catch all for changes in HTML output, please adjust if the changes are innocent.
- Parameters:
metaschema_doc (str)
tmp_path (pathlib.Path)
- Return type:
None
schema_salad.tests.test_misc
Module Contents
Functions
- schema_salad.tests.test_misc.test_misc()
- Return type:
None
- schema_salad.tests.test_misc.test_load_schema_cache()
- Return type:
None
schema_salad.tests.test_pickling
Tests to ensure that mypyc compiled classes are still pickleable.
See https://mypyc.readthedocs.io/en/latest/differences_from_python.html#pickling-and-copying-objects
Module Contents
Functions
Targeted test of pickling a RecordSchema. |
|
|
- schema_salad.tests.test_pickling.test_recordschema_pickle()
Targeted test of pickling a RecordSchema.
- Return type:
None
- schema_salad.tests.test_pickling.test_extend_and_specialize_enums(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
schema_salad.tests.test_print_oneline
Module Contents
Functions
- schema_salad.tests.test_print_oneline.test_print_oneline()
- Return type:
None
- schema_salad.tests.test_print_oneline.test_print_oneline_for_invalid_yaml()
- Return type:
None
- schema_salad.tests.test_print_oneline.test_print_oneline_for_errors_in_the_same_line()
- Return type:
None
- schema_salad.tests.test_print_oneline.test_print_oneline_for_errors_in_resolve_ref()
- Return type:
None
- schema_salad.tests.test_print_oneline.test_for_invalid_yaml1()
- Return type:
None
- schema_salad.tests.test_print_oneline.test_for_invalid_yaml2()
- Return type:
None
schema_salad.tests.test_python_codegen
Module Contents
Functions
Affirm correct construction of identifiers safe for Python. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Test the RDFLib Graph representation of the $schemas directive. |
|
Test that LoadingOptions properly cache the $schemas RDFLib Graph representations. |
|
Test that an empty RDFLib Graph is returned when not $schemas directive is present. |
- schema_salad.tests.test_python_codegen.test_safe_identifiers()
Affirm correct construction of identifiers safe for Python.
- Return type:
None
- schema_salad.tests.test_python_codegen.test_cwl_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_python_codegen.test_meta_schema_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_python_codegen.test_meta_schema_gen_up_to_date(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_python_codegen.test_meta_schema_gen_no_base(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_python_codegen.python_codegen(file_uri, target, parser_info=None, package=None)
- Parameters:
file_uri (str)
target (pathlib.Path)
parser_info (Optional[str])
package (Optional[str])
- Return type:
None
- schema_salad.tests.test_python_codegen.test_default_parser_info(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_python_codegen.test_parser_info(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_python_codegen.test_use_of_package_for_parser_info(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_python_codegen.test_graph_property()
Test the RDFLib Graph representation of the $schemas directive.
- Return type:
None
- schema_salad.tests.test_python_codegen.test_graph_property_cache()
Test that LoadingOptions properly cache the $schemas RDFLib Graph representations.
- Return type:
None
- schema_salad.tests.test_python_codegen.test_graph_property_empty_schema()
Test that an empty RDFLib Graph is returned when not $schemas directive is present.
- Return type:
None
schema_salad.tests.test_real_cwl
Checks loading of some real world tools and workflows found in the wild (e.g. dockstore)
run individually as py.test -k tests/test_real_cwl.py
Module Contents
Classes
Attributes
- schema_salad.tests.test_real_cwl.test_dir_name = 'tests/test_real_cwl/'
- class schema_salad.tests.test_real_cwl.TestRealWorldCWL
- document_loader: schema_salad.ref_resolver.Loader
- metaschema_loader: schema_salad.ref_resolver.Loader | None
- classmethod setup_class()
- Return type:
None
- test_topmed_single_doc()
TOPMed Variant Calling Pipeline CWL1
- Return type:
None
- test_h3agatk_WES()
H3ABioNet GATK Germline Workflow
- Return type:
None
- test_h3agatk_SNP()
H3ABioNet SNPs Workflow
- Return type:
None
- test_icgc_pancan()
ICGC PanCan
- Return type:
None
schema_salad.tests.test_ref_resolver
Test the ref_resolver module.
Module Contents
Functions
|
|
|
|
|
|
|
|
|
|
|
From issue #cwltool/issues/1635. A Workflow with a Step without |
- schema_salad.tests.test_ref_resolver.is_fs_case_sensitive(path)
- schema_salad.tests.test_ref_resolver.tmp_dir_fixture(request)
- Parameters:
request (_pytest.fixtures.FixtureRequest)
- Return type:
- schema_salad.tests.test_ref_resolver.test_Loader_initialisation_for_HOME_env_var(tmp_dir_fixture)
- Parameters:
tmp_dir_fixture (str)
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_Loader_initialisation_for_TMP_env_var(tmp_dir_fixture)
- Parameters:
tmp_dir_fixture (str)
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_Loader_initialisation_with_neither_TMP_HOME_set(tmp_dir_fixture)
- Parameters:
tmp_dir_fixture (str)
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_Loader_initialisation_disable_doc_cache(tmp_dir_fixture)
- Parameters:
tmp_dir_fixture (str)
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_DefaultFetcher_urljoin_win32(tmp_dir_fixture)
- Parameters:
tmp_dir_fixture (str)
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_DefaultFetcher_urljoin_linux(tmp_dir_fixture)
- Parameters:
tmp_dir_fixture (str)
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_import_list()
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_fetch_inject_id()
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_attachments()
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_check_exists_follows_redirects()
- Return type:
None
- schema_salad.tests.test_ref_resolver.test_resolve_missing_step_id(caplog)
From issue #cwltool/issues/1635. A Workflow with a Step without the name attribute must raise a ValidationException that contains the SourceLine data.
- Parameters:
caplog (Any)
- Return type:
None
schema_salad.tests.test_schema
Module Contents
Functions
|
Attributes
- schema_salad.tests.test_schema.cwl_file_uri
- schema_salad.tests.test_schema.test_extend_and_specialize_enums(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
schema_salad.tests.test_schemas_directive
Checks for accepting $schemas directive
run individually as py.test -k tests/test_schemas_directive.py
Module Contents
Classes
Ensure codegen-produced parsers accept $schemas directives |
Attributes
- schema_salad.tests.test_schemas_directive.test_dir_name = 'tests/'
- class schema_salad.tests.test_schemas_directive.TestSchemasDirective
Ensure codegen-produced parsers accept $schemas directives
- document_loader: schema_salad.ref_resolver.Loader
- metaschema_loader: schema_salad.ref_resolver.Loader | None
- classmethod setup_class()
- Return type:
None
- test_dollarsign_schema()
EDAM.owl as a schema
- Return type:
None
schema_salad.tests.test_subtypes
Confirm subtypes.
Module Contents
Functions
|
Test is_subtype() function. |
Confirm conversion of SALAD style names to avro when overriding. |
|
Confirm subtype error when overriding incorrectly. |
|
Confirm correct subtype handling on a nested type definition. |
|
Confirm subtype error when overriding incorrectly in nested types. |
|
Confirm correct subtype handling on a recursive type definition. |
|
Confirm correct subtype handling on an union type definition. |
|
Confirm subtype error when overriding incorrectly in array types. |
Attributes
- schema_salad.tests.test_subtypes.types = [(['int', 'float', 'double'], 'int', True), (['int', 'float', 'double'], ['int'], True),...
- schema_salad.tests.test_subtypes.test_subtypes(old, new, result)
Test is_subtype() function.
- Parameters:
old (schema_salad.avro.schema.PropType)
new (schema_salad.avro.schema.PropType)
result (bool)
- Return type:
None
- schema_salad.tests.test_subtypes.test_avro_loading_subtype()
Confirm conversion of SALAD style names to avro when overriding.
- Return type:
None
- schema_salad.tests.test_subtypes.test_avro_loading_subtype_bad()
Confirm subtype error when overriding incorrectly.
- Return type:
None
- schema_salad.tests.test_subtypes.test_subtypes_nested()
Confirm correct subtype handling on a nested type definition.
- Return type:
None
- schema_salad.tests.test_subtypes.test_subtypes_nested_bad()
Confirm subtype error when overriding incorrectly in nested types.
- Return type:
None
- schema_salad.tests.test_subtypes.test_subtypes_recursive()
Confirm correct subtype handling on a recursive type definition.
- Return type:
None
- schema_salad.tests.test_subtypes.test_subtypes_union()
Confirm correct subtype handling on an union type definition.
- Return type:
None
- schema_salad.tests.test_subtypes.test_subtypes_union_bad()
Confirm subtype error when overriding incorrectly in array types.
- Return type:
None
schema_salad.tests.test_typescript_codegen
Module Contents
Functions
|
|
|
|
|
|
|
|
|
Attributes
- schema_salad.tests.test_typescript_codegen.test_cwl_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_typescript_codegen.test_meta_schema_gen(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_typescript_codegen.test_class_field(tmp_path)
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- schema_salad.tests.test_typescript_codegen.get_data_uri(resource_path)
- schema_salad.tests.test_typescript_codegen.cwl_file_uri
- schema_salad.tests.test_typescript_codegen.metaschema_file_uri
- schema_salad.tests.test_typescript_codegen.typescript_codegen(file_uri, target, examples=None)
- Parameters:
file_uri (str)
target (pathlib.Path)
examples (Optional[pathlib.Path])
- Return type:
None
schema_salad.tests.util
Shared test functions and attributes.
Module Contents
Functions
|
Get the file path for a given schema file name. |
|
Get the file URI for tests. |
Attributes
- schema_salad.tests.util.get_data(filename)
Get the file path for a given schema file name.
It is able to find file names in the
schema_salad
namespace, but also able to load schema files from thetests
directory.
- schema_salad.tests.util.get_data_uri(resource_path)
Get the file URI for tests.
- schema_salad.tests.util.cwl_file_uri
- schema_salad.tests.util.metaschema_file_uri
- schema_salad.tests.util.basket_file_uri
Submodules
schema_salad.__main__
Default entry point for the schema-salad module.
schema_salad.codegen
Generate language specific loaders for a particular SALAD schema.
Module Contents
Functions
|
Generate classes with loaders for the given Schema Salad description. |
Attributes
- schema_salad.codegen.FIELD_SORT_ORDER = ['id', 'class', 'name']
- schema_salad.codegen.codegen(lang, i, schema_metadata, loader, target=None, examples=None, package=None, copyright=None, spdx_copyright_text=None, spdx_license_identifier=None, parser_info=None)
Generate classes with loaders for the given Schema Salad description.
- Parameters:
- Return type:
None
schema_salad.codegen_base
Base class for the generation of loaders from schema-salad definitions.
Module Contents
Classes
Schema Salad type description. |
|
Lazy initialization logic. |
|
Abstract base class for schema salad code generators. |
- class schema_salad.codegen_base.TypeDef(name, init, is_uri=False, scoped_id=False, ref_scope=0, loader_type=None, instance_type=None, abstract=False)
Schema Salad type description.
- Parameters:
- __slots__ = ['name', 'init', 'is_uri', 'scoped_id', 'ref_scope', 'loader_type', 'instance_type', 'abstract']
- class schema_salad.codegen_base.LazyInitDef(name, init)
Lazy initialization logic.
- __slots__ = ('name', 'init')
- class schema_salad.codegen_base.CodeGenBase
Abstract base class for schema salad code generators.
- declare_type(declared_type)
Add this type to our collection, if needed.
- add_lazy_init(lazy_init)
Add lazy initialization logic for a given type.
- Parameters:
lazy_init (LazyInitDef)
- Return type:
None
- add_vocab(name, uri)
Add the given name as an abbreviation for the given URI.
- abstract prologue()
Trigger to generate the prolouge code.
- Return type:
None
- abstract static safe_name(name)
Generate a safe version of the given name.
- abstract begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)
Produce the header for the given class.
- abstract end_class(classname, field_names)
Signal that we are done with this class.
- abstract type_loader(type_declaration, container=None, no_link_check=None)
Parse the given type declaration and declare its components.
- abstract declare_field(name, fieldtype, doc, optional, subscope)
Output the code to load the given field.
- abstract declare_id_field(name, fieldtype, doc, optional)
Output the code to handle the given ID field.
- abstract uri_loader(inner, scoped_id, vocab_term, ref_scope, no_link_check=None)
Construct the TypeDef for the given URI loader.
- abstract idmap_loader(field, inner, map_subject, map_predicate)
Construct the TypeDef for the given mapped ID loader.
- abstract typedsl_loader(inner, ref_scope)
Construct the TypeDef for the given DSL loader.
schema_salad.cpp_codegen
C++17 code generator for a given Schema Salad definition.
Currently only supports emiting YAML from the C++ objects, not yet parsing YAML into C++ objects.
The generated code requires the libyaml-cpp library & headers
To see an example of usage, look at schema_salad/tests/codegen/cwl.cpp which can be combined with the CWL V1.0 schema as shown below:
schema-salad-tool --codegen cpp schema_salad/tests/test_schema/CommonWorkflowLanguage.yml > cwl_v1_0.h
g++ --std=c++20 -I. -lyaml-cpp schema_salad/tests/codegen/cwl.cpp -o cwl-v1_0-test
./cwl-v1_0-test
# g++ versions older than version 10 may need "--std=c++2a" instead of "--std=c++20"
Module Contents
Classes
Prototype of a class. |
|
Prototype of a single field from a class definition. |
|
Prototype of a map. |
|
Prototype of a union. |
|
Prototype of a enum. |
|
Generation of C++ code for a given Schema Salad definition. |
Functions
|
Put quotes around a string. |
Rename keywords that are reserved in C++. |
|
|
Create a C++ safe name. |
|
Create a namespaced safename. |
|
Split url name into its components. |
|
Split field into its components. |
Check if v is a primitve type. |
|
|
Check if e has a field f value. |
Check if v is of type record schema. |
|
|
Check if v is of type enum schema. |
|
Check if v is of type array. |
|
Check if v is any of the simple types. |
Check if v is of type array schema. |
|
|
Check if v is of type map schema. |
Check if v is of type union schema. |
- schema_salad.cpp_codegen.replaceKeywords(s)
Rename keywords that are reserved in C++.
- schema_salad.cpp_codegen.safename(name)
Create a C++ safe name.
- schema_salad.cpp_codegen.safename2(name)
Create a namespaced safename.
- schema_salad.cpp_codegen.split_name(s)
Split url name into its components.
Splits names like https://xyz.xyz/blub#cwl/class into its class path and non class path
- schema_salad.cpp_codegen.split_field(s)
Split field into its components.
similar to split_name but for field names
- class schema_salad.cpp_codegen.ClassDefinition(name)
Prototype of a class.
- Parameters:
name (str)
- writeFwdDeclaration(target, fullInd, ind)
Write forward declaration.
- writeDefinition(target, fullInd, ind)
Write definition of the class.
- class schema_salad.cpp_codegen.FieldDefinition(name, typeStr, optional, remap)
Prototype of a single field from a class definition.
- class schema_salad.cpp_codegen.MapDefinition(name, values)
Prototype of a map.
- writeFwdDeclaration(target, fullInd, ind)
Write forward declaration.
- writeDefinition(target, ind)
Write map definition to output.
- class schema_salad.cpp_codegen.UnionDefinition(name, types)
Prototype of a union.
- writeFwdDeclaration(target, fullInd, ind)
Write forward declaration.
- writeDefinition(target, ind)
Write union definition to output.
- class schema_salad.cpp_codegen.EnumDefinition(name, values)
Prototype of a enum.
- schema_salad.cpp_codegen.isPrimitiveType(v)
Check if v is a primitve type.
- Parameters:
v (Any)
- Return type:
- schema_salad.cpp_codegen.hasFieldValue(e, f, v)
Check if e has a field f value.
- schema_salad.cpp_codegen.isRecordSchema(v)
Check if v is of type record schema.
- Parameters:
v (Any)
- Return type:
- schema_salad.cpp_codegen.isEnumSchema(v)
Check if v is of type enum schema.
- Parameters:
v (Any)
- Return type:
- schema_salad.cpp_codegen.isArray(v)
Check if v is of type array.
- Parameters:
v (Any)
- Return type:
- schema_salad.cpp_codegen.pred(i)
Check if v is any of the simple types.
- Parameters:
i (Any)
- Return type:
- schema_salad.cpp_codegen.isArraySchema(v)
Check if v is of type array schema.
- Parameters:
v (Any)
- Return type:
- schema_salad.cpp_codegen.isMapSchema(v)
Check if v is of type map schema.
- Parameters:
v (Any)
- Return type:
- schema_salad.cpp_codegen.isUnionSchema(v)
Check if v is of type union schema.
- Parameters:
v (Any)
- Return type:
- class schema_salad.cpp_codegen.CppCodeGen(base, target, examples, package, copyright, spdx_copyright_text, spdx_license_identifier)
Bases:
digraph inheritanceb32d88fe87 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="index.html#schema_salad.codegen_base.CodeGenBase",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="Abstract base class for schema salad code generators."]; "CppCodeGen" [URL="#schema_salad.cpp_codegen.CppCodeGen",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="Generation of C++ code for a given Schema Salad definition."]; "CodeGenBase" -> "CppCodeGen" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.codegen_base.CodeGenBase
Generation of C++ code for a given Schema Salad definition.
- Parameters:
- convertTypeToCpp(type_declaration)
Convert a Schema Salad type to a C++ type.
- epilogue(root_loader)
Generate final part of our cpp file.
- Parameters:
root_loader (Optional[schema_salad.codegen_base.TypeDef])
- Return type:
None
schema_salad.dlang_codegen
D code generator for a given schema salad definition.
Module Contents
Classes
Generation of D code for a given Schema Salad definition. |
- class schema_salad.dlang_codegen.DlangCodeGen(base, target, examples, package, copyright_, parser_info, salad_version)
Bases:
digraph inheritancef362c970f6 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="index.html#schema_salad.codegen_base.CodeGenBase",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="Abstract base class for schema salad code generators."]; "DlangCodeGen" [URL="#schema_salad.dlang_codegen.DlangCodeGen",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="Generation of D code for a given Schema Salad definition."]; "CodeGenBase" -> "DlangCodeGen" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.codegen_base.CodeGenBase
Generation of D code for a given Schema Salad definition.
- Parameters:
- prologue()
Trigger to generate the prolouge code.
- Return type:
None
- epilogue(root_loader)
Trigger to generate the epilouge code.
- Parameters:
root_loader (schema_salad.codegen_base.TypeDef)
- Return type:
None
- static safe_name(name)
Generate a safe version of the given name.
- to_doc_comment(doc)
Return an embedded documentation comments for a given string.
- parse_record_field_type(type_, jsonld_pred)
Return an annotation string and a type string.
- parse_record_field(field, parent_name=None)
Return a declaration string for a given record field.
- parse_record_schema(stype)
Return a declaration string for a given record schema.
- parse_enum(stype)
Return a declaration string for a given enum schema.
schema_salad.dotnet_codegen
DotNet code generator for a given schema salad definition.
Module Contents
Classes
Generation of TypeScript code for a given Schema Salad definition. |
Functions
|
Generate a documentation string from a schema salad doc field. |
Attributes
- schema_salad.dotnet_codegen.doc_to_doc_string(doc, indent_level=0)
Generate a documentation string from a schema salad doc field.
- schema_salad.dotnet_codegen.prims
- class schema_salad.dotnet_codegen.DotNetCodeGen(base, examples, target, package)
Bases:
digraph inheritancee100b2d656 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="index.html#schema_salad.codegen_base.CodeGenBase",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="Abstract base class for schema salad code generators."]; "DotNetCodeGen" [URL="#schema_salad.dotnet_codegen.DotNetCodeGen",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="Generation of TypeScript code for a given Schema Salad definition."]; "CodeGenBase" -> "DotNetCodeGen" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.codegen_base.CodeGenBase
Generation of TypeScript code for a given Schema Salad definition.
- prologue()
Trigger to generate the prolouge code.
- Return type:
None
- static safe_name(name)
Generate a safe version of the given name.
- begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)
Produce the header for the given class.
- end_class(classname, field_names)
Signal that we are done with this class.
- type_loader(type_declaration, container=None, no_link_check=None)
Parse the given type declaration and declare its components.
- Parameters:
- Return type:
- declare_field(name, fieldtype, doc, optional, subscope)
Output the code to load the given field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
subscope (Optional[str])
- Return type:
None
- declare_id_field(name, fieldtype, doc, optional)
Output the code to handle the given ID field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
- Return type:
None
- to_dotnet(val)
Convert a Python keyword to a DotNet keyword.
- Parameters:
val (Any)
- Return type:
Any
- uri_loader(inner, scoped_id, vocab_term, ref_scope, no_link_check=None)
Construct the TypeDef for the given URI loader.
- idmap_loader(field, inner, map_subject, map_predicate)
Construct the TypeDef for the given mapped ID loader.
- typedsl_loader(inner, ref_scope)
Construct the TypeDef for the given DSL loader.
- Parameters:
ref_scope (Optional[int])
- Return type:
- epilogue(root_loader)
Trigger to generate the epilouge code.
- Parameters:
root_loader (schema_salad.codegen_base.TypeDef)
- Return type:
None
- secondaryfilesdsl_loader(inner)
Construct the TypeDef for secondary files.
- Parameters:
- Return type:
schema_salad.exceptions
Shared Exception classes.
Module Contents
Functions
|
- exception schema_salad.exceptions.SchemaSaladException(msg, sl=None, children=None, bullet_for_children='')
Bases:
digraph inheritancec785f3f71d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "SchemaSaladException" [URL="#schema_salad.exceptions.SchemaSaladException",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="Base class for all schema-salad exceptions."]; }Exception
Base class for all schema-salad exceptions.
- Parameters:
msg (str)
sl (Optional[schema_salad.sourceline.SourceLine])
children (Optional[Sequence[SchemaSaladException]])
bullet_for_children (str)
- propagate_sourceline()
- Return type:
None
- as_warning()
- Return type:
- with_sourceline(sl)
- Parameters:
sl (Optional[schema_salad.sourceline.SourceLine])
- Return type:
- leaves()
- Return type:
List[SchemaSaladException]
- __str__()
Convert to a string using
pretty_str()
.- Return type:
- exception schema_salad.exceptions.SchemaException(msg, sl=None, children=None, bullet_for_children='')
Bases:
digraph inheritance39122d3403 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "SchemaException" [URL="#schema_salad.exceptions.SchemaException",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="Indicates error with the provided schema definition."]; "SchemaSaladException" -> "SchemaException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaSaladException" [URL="#schema_salad.exceptions.SchemaSaladException",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="Base class for all schema-salad exceptions."]; }SchemaSaladException
Indicates error with the provided schema definition.
- Parameters:
msg (str)
sl (Optional[schema_salad.sourceline.SourceLine])
children (Optional[Sequence[SchemaSaladException]])
bullet_for_children (str)
- exception schema_salad.exceptions.ValidationException(msg, sl=None, children=None, bullet_for_children='')
Bases:
digraph inheritance12502e6bbe { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "SchemaSaladException" [URL="#schema_salad.exceptions.SchemaSaladException",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="Base class for all schema-salad exceptions."]; "ValidationException" [URL="#schema_salad.exceptions.ValidationException",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="Indicates error with document against the provided schema."]; "SchemaSaladException" -> "ValidationException" [arrowsize=0.5,style="setlinewidth(0.5)"]; }SchemaSaladException
Indicates error with document against the provided schema.
- Parameters:
msg (str)
sl (Optional[schema_salad.sourceline.SourceLine])
children (Optional[Sequence[SchemaSaladException]])
bullet_for_children (str)
- exception schema_salad.exceptions.ClassValidationException(msg, sl=None, children=None, bullet_for_children='')
Bases:
digraph inheritanceb7f51938a5 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ClassValidationException" [URL="#schema_salad.exceptions.ClassValidationException",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"]; "ValidationException" -> "ClassValidationException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaSaladException" [URL="#schema_salad.exceptions.SchemaSaladException",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="Base class for all schema-salad exceptions."]; "ValidationException" [URL="#schema_salad.exceptions.ValidationException",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="Indicates error with document against the provided schema."]; "SchemaSaladException" -> "ValidationException" [arrowsize=0.5,style="setlinewidth(0.5)"]; }ValidationException
Indicates error with document against the provided schema.
- Parameters:
msg (str)
sl (Optional[schema_salad.sourceline.SourceLine])
children (Optional[Sequence[SchemaSaladException]])
bullet_for_children (str)
- schema_salad.exceptions.to_one_line_messages(exc)
- Parameters:
exc (SchemaSaladException)
- Return type:
schema_salad.fetcher
Resource fetching.
Module Contents
Classes
Fetch resources from URIs. |
|
Fetcher that caches resources in memory after retrieval. |
|
The default Fetcher implementation. |
- class schema_salad.fetcher.Fetcher
Bases:
digraph inheritancef27fba63b1 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Fetcher" [URL="#schema_salad.fetcher.Fetcher",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="Fetch resources from URIs."]; "ABC" -> "Fetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; }abc.ABC
Fetch resources from URIs.
- schemes = ['file', 'http', 'https', 'mailto']
- abstract fetch_text(url, content_types=None)
Retrieve the given resource as a string.
- abstract check_exists(url)
Check if the given resource exists.
- abstract urljoin(base_url, url)
Construct a full (“absolute”) URL by combining a “base URL” with another URL.
- class schema_salad.fetcher.MemoryCachingFetcher(cache)
Bases:
digraph inheritancede13b772e8 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Fetcher" [URL="#schema_salad.fetcher.Fetcher",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="Fetch resources from URIs."]; "ABC" -> "Fetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MemoryCachingFetcher" [URL="#schema_salad.fetcher.MemoryCachingFetcher",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="Fetcher that caches resources in memory after retrieval."]; "Fetcher" -> "MemoryCachingFetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Fetcher
Fetcher that caches resources in memory after retrieval.
- Parameters:
cache (schema_salad.utils.CacheType)
- class schema_salad.fetcher.DefaultFetcher(cache, session)
Bases:
digraph inheritance4470177d80 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "DefaultFetcher" [URL="#schema_salad.fetcher.DefaultFetcher",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="The default Fetcher implementation."]; "MemoryCachingFetcher" -> "DefaultFetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Fetcher" [URL="#schema_salad.fetcher.Fetcher",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="Fetch resources from URIs."]; "ABC" -> "Fetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MemoryCachingFetcher" [URL="#schema_salad.fetcher.MemoryCachingFetcher",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="Fetcher that caches resources in memory after retrieval."]; "Fetcher" -> "MemoryCachingFetcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; }MemoryCachingFetcher
The default Fetcher implementation.
- Parameters:
cache (schema_salad.utils.CacheType)
session (Optional[requests.sessions.Session])
- fetch_text(url, content_types=None)
Retrieve the given resource as a string.
schema_salad.java_codegen
Java code generator for a given schema salad definition.
Module Contents
Classes
Abstract base class for schema salad code generators. |
Functions
|
Attributes
- schema_salad.java_codegen.USE_ONE_OR_LIST_OF_TYPES = False
- schema_salad.java_codegen.BASIC_JAVA_IDENTIFIER_RE
- schema_salad.java_codegen.doc_to_doc_string(doc, indent_level=0)
- schema_salad.java_codegen.prims
- class schema_salad.java_codegen.JavaCodeGen(base, target, examples, package, copyright)
Bases:
digraph inheritance75c0201e38 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="index.html#schema_salad.codegen_base.CodeGenBase",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="Abstract base class for schema salad code generators."]; "JavaCodeGen" [URL="#schema_salad.java_codegen.JavaCodeGen",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"]; "CodeGenBase" -> "JavaCodeGen" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.codegen_base.CodeGenBase
Abstract base class for schema salad code generators.
- Parameters:
- prologue()
Trigger to generate the prolouge code.
- Return type:
None
- static safe_name(name)
Generate a safe version of the given name.
- begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)
Produce the header for the given class.
- end_class(classname, field_names)
Finish this class.
- type_loader(type_declaration, container=None, no_link_check=None)
Parse the given type declaration and declare its components.
- Parameters:
- Return type:
- declare_field(name, fieldtype, doc, optional, subscope)
Output the code to load the given field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
subscope (Optional[str])
- Return type:
None
- declare_id_field(name, fieldtype, doc, optional)
Output the code to handle the given ID field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
- Return type:
None
- uri_loader(inner, scoped_id, vocab_term, ref_scope, no_link_check=None)
Construct the TypeDef for the given URI loader.
- idmap_loader(field, inner, map_subject, map_predicate)
Construct the TypeDef for the given mapped ID loader.
- typedsl_loader(inner, ref_scope)
Construct the TypeDef for the given DSL loader.
- Parameters:
ref_scope (Union[int, None])
- Return type:
- to_java(val)
- Parameters:
val (Any)
- Return type:
Any
- epilogue(root_loader)
Trigger to generate the epilouge code.
- Parameters:
root_loader (schema_salad.codegen_base.TypeDef)
- Return type:
None
- secondaryfilesdsl_loader(inner)
Construct the TypeDef for secondary files.
- Parameters:
- Return type:
schema_salad.jsonld_context
Module Contents
Functions
|
|
|
|
|
|
|
Add missing identity entries. |
|
- schema_salad.jsonld_context.pred(datatype, field, name, context, defaultBase, namespaces)
- schema_salad.jsonld_context.process_type(t, g, context, defaultBase, namespaces, defaultPrefix)
- Parameters:
t (MutableMapping[str, Any])
g (rdflib.Graph)
context (schema_salad.utils.ContextType)
defaultBase (str)
namespaces (Dict[str, rdflib.namespace.Namespace])
defaultPrefix (str)
- Return type:
None
- schema_salad.jsonld_context.salad_to_jsonld_context(j, schema_ctx)
- Parameters:
- Return type:
Tuple[schema_salad.utils.ContextType, rdflib.Graph]
- schema_salad.jsonld_context.fix_jsonld_ids(obj, ids)
Add missing identity entries.
- schema_salad.jsonld_context.makerdf(workflow, wf, ctx, graph=None)
- Parameters:
workflow (Optional[str])
wf (Union[ruamel.yaml.comments.CommentedMap, float, str, ruamel.yaml.comments.CommentedSeq])
ctx (schema_salad.utils.ContextType)
graph (Optional[rdflib.Graph])
- Return type:
schema_salad.main
Command line interface to schema-salad.
Module Contents
Functions
|
|
Build the argument parser. |
|
|
- schema_salad.main.printrdf(workflow, wf, ctx, sr)
- schema_salad.main.arg_parser()
Build the argument parser.
- Return type:
schema_salad.makedoc
Module Contents
Classes
Custom renderer with different representations of selected HTML tags. |
|
Functions
|
Escape HTML but otherwise preserve single quotes. |
|
Remove the avro namespace, if any. |
|
|
|
|
|
Reverts fenced code fragments found in the modified contents back to their original definition. |
|
|
|
|
|
|
|
|
Build the argument parser. |
|
|
Shortcut entrypoint. |
|
Emit HTML representation of a given schema. |
Attributes
- schema_salad.makedoc.PluginName
- schema_salad.makedoc.escape_html(s)
Escape HTML but otherwise preserve single quotes.
- schema_salad.makedoc.vocab_type_name(url)
Remove the avro namespace, if any.
- class schema_salad.makedoc.MyRenderer(escape=True, allow_harmful_protocols=None)
Bases:
digraph inheritanced9b3aab934 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BaseRenderer" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "HTMLRenderer" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A renderer for converting Markdown to HTML."]; "BaseRenderer" -> "HTMLRenderer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MyRenderer" [URL="#schema_salad.makedoc.MyRenderer",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="Custom renderer with different representations of selected HTML tags."]; "HTMLRenderer" -> "MyRenderer" [arrowsize=0.5,style="setlinewidth(0.5)"]; }mistune.renderers.html.HTMLRenderer
Custom renderer with different representations of selected HTML tags.
- heading(text, level, **attrs)
Override HTML heading creation with text IDs.
- inline_html(html)
Don’t escape characters in predefined HTML within paragraph tags.
- block_html(html)
Don’t escape characters nor wrap predefined HTML within paragraph tags.
- schema_salad.makedoc.patch_fenced_code(original_markdown_text, modified_markdown_text)
Reverts fenced code fragments found in the modified contents back to their original definition.
- schema_salad.makedoc.basicTypes = ('https://w3id.org/cwl/salad#null', 'http://www.w3.org/2001/XMLSchema#boolean',...
- schema_salad.makedoc.number_headings(toc, maindoc)
- class schema_salad.makedoc.RenderType(toc, j, renderlist, redirects, primitiveType)
- Parameters:
- typefmt(tp, redirects, nbsp=False, jsonldPredicate=None)
- schema_salad.makedoc.avrold_doc(j, outdoc, renderlist, redirects, brand, brandlink, primtype, brandstyle=None, brandinverse=False)
- schema_salad.makedoc.arg_parser()
Build the argument parser.
- Return type:
- schema_salad.makedoc.main()
Shortcut entrypoint.
- Return type:
None
- schema_salad.makedoc.makedoc(stdout, schema, redirects=None, only=None, brand=None, brandlink=None, primtype=None, brandstyle=None, brandinverse=False)
Emit HTML representation of a given schema.
schema_salad.metaschema
Module Contents
Classes
Mark classes than have a save() and fromDoc() function. |
|
Mark classes than have a save() and fromDoc() function. |
|
A field of a record. |
|
Mark classes than have a save() and fromDoc() function. |
|
Define an enumerated type. |
|
Mark classes than have a save() and fromDoc() function. |
|
Mark classes than have a save() and fromDoc() function. |
|
Mark classes than have a save() and fromDoc() function. |
|
Attached to a record field to define how the parent record field is handled for |
|
Mark classes than have a save() and fromDoc() function. |
|
Mark classes than have a save() and fromDoc() function. |
|
Mark classes than have a save() and fromDoc() function. |
|
Abstract base for schema-defined types. |
|
A field of a record. |
|
Mark classes than have a save() and fromDoc() function. |
|
Define an enumerated type. |
|
Define a map type. |
|
Define a union type. |
|
A documentation section. This type exists to facilitate self-documenting |
Functions
|
Load field. |
|
Take a type of value, and extracts the value as a string. |
|
Normalize type names to schema-salad types. |
|
Parse error messages from several loaders into one error message. |
|
|
|
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level. |
|
|
|
Transform a file path into a URL with file scheme. |
|
Expand short forms into full URLs using the given namespace dictionary. |
|
Convert any URI to a relative one, obeying the scoping rules. |
|
Compute the shortname of a fully qualified identifier. |
|
|
|
|
|
|
|
Shortcut to load via a YAML object. |
Attributes
Names of salad data types (based on Avro schema declarations). |
|
The Any type validates for any non-null value. |
|
|
|
|
|
|
|
|
|
|
|
- schema_salad.metaschema.IdxType
- class schema_salad.metaschema.LoadingOptions(fetcher=None, namespaces=None, schemas=None, fileuri=None, copyfrom=None, original_doc=None, addl_metadata=None, baseuri=None, idx=None, imports=None, includes=None, no_link_check=None, container=None)
- Parameters:
fetcher (Optional[schema_salad.fetcher.Fetcher])
schemas (Optional[List[str]])
fileuri (Optional[str])
copyfrom (Optional[LoadingOptions])
original_doc (Optional[Any])
baseuri (Optional[str])
idx (Optional[IdxType])
imports (Optional[List[str]])
includes (Optional[List[str]])
no_link_check (Optional[bool])
container (Optional[str])
- property graph: rdflib.Graph
Generate a merged rdflib.Graph from all entries in self.schemas.
- Return type:
- idx: IdxType
- fetcher: schema_salad.fetcher.Fetcher
- cache: schema_salad.utils.CacheType
- class schema_salad.metaschema.Saveable
Bases:
digraph inheritanced0872ffd38 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }abc.ABC
Mark classes than have a save() and fromDoc() function.
- abstract classmethod fromDoc(_doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
_doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- schema_salad.metaschema.load_field(val, fieldtype, baseuri, loadingOptions, lc=None)
Load field.
- Parameters:
fieldtype (_Loader)
baseuri (str)
loadingOptions (LoadingOptions)
lc (Optional[List[Any]])
- Return type:
Any
- schema_salad.metaschema.save_type
- schema_salad.metaschema.extract_type(val_type)
Take a type of value, and extracts the value as a string.
- Parameters:
val_type (Type[Any])
- Return type:
- schema_salad.metaschema.convert_typing(val_type)
Normalize type names to schema-salad types.
- schema_salad.metaschema.parse_errors(error_message)
Parse error messages from several loaders into one error message.
- schema_salad.metaschema.save(val, top=True, base_url='', relative_uris=True)
- schema_salad.metaschema.save_with_metadata(val, valLoadingOpts, top=True, base_url='', relative_uris=True)
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level.
- Parameters:
val (Any)
valLoadingOpts (LoadingOptions)
top (bool)
base_url (str)
relative_uris (bool)
- Return type:
save_type
- schema_salad.metaschema.expand_url(url, base_url, loadingOptions, scoped_id=False, vocab_term=False, scoped_ref=None)
- schema_salad.metaschema.file_uri(path, split_frag=False)
Transform a file path into a URL with file scheme.
- schema_salad.metaschema.prefix_url(url, namespaces)
Expand short forms into full URLs using the given namespace dictionary.
- schema_salad.metaschema.save_relative_uri(uri, base_url, scoped_id, ref_scope, relative_uris)
Convert any URI to a relative one, obeying the scoping rules.
- schema_salad.metaschema.shortname(inputid)
Compute the shortname of a fully qualified identifier.
- class schema_salad.metaschema.Documented
Bases:
digraph inheritancea7a74ee728 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Mark classes than have a save() and fromDoc() function.
- class schema_salad.metaschema.RecordField(name, type_, doc=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance2c5cf93dd6 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RecordField" [URL="#schema_salad.metaschema.RecordField",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 field of a record."]; "Documented" -> "RecordField" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Documented
A field of a record.
- Parameters:
name (Any)
type_ (Any)
doc (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.RecordSchema(type_, fields=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance1f940565de { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "RecordSchema" [URL="#schema_salad.metaschema.RecordSchema",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"]; "Saveable" -> "RecordSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Mark classes than have a save() and fromDoc() function.
- Parameters:
type_ (Any)
fields (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.EnumSchema(symbols, type_, name=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritancea9629043e4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "EnumSchema" [URL="#schema_salad.metaschema.EnumSchema",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="Define an enumerated type."]; "Saveable" -> "EnumSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Define an enumerated type.
- Parameters:
symbols (Any)
type_ (Any)
name (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.ArraySchema(items, type_, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance40ad3e0a5b { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "ArraySchema" [URL="#schema_salad.metaschema.ArraySchema",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"]; "Saveable" -> "ArraySchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Mark classes than have a save() and fromDoc() function.
- Parameters:
items (Any)
type_ (Any)
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.MapSchema(type_, values, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance73dd454783 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "MapSchema" [URL="#schema_salad.metaschema.MapSchema",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"]; "Saveable" -> "MapSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Mark classes than have a save() and fromDoc() function.
- Parameters:
type_ (Any)
values (Any)
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.UnionSchema(names, type_, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance987c9db977 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "UnionSchema" [URL="#schema_salad.metaschema.UnionSchema",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"]; "Saveable" -> "UnionSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Mark classes than have a save() and fromDoc() function.
- Parameters:
names (Any)
type_ (Any)
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.JsonldPredicate(_id=None, _type=None, _container=None, identity=None, noLinkCheck=None, mapSubject=None, mapPredicate=None, refScope=None, typeDSL=None, secondaryFilesDSL=None, subscope=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance471ed4e28d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "JsonldPredicate" [URL="#schema_salad.metaschema.JsonldPredicate",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="Attached to a record field to define how the parent record field is handled for"]; "Saveable" -> "JsonldPredicate" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Attached to a record field to define how the parent record field is handled for URI resolution and JSON-LD context generation.
- Parameters:
_id (Optional[Any])
_type (Optional[Any])
_container (Optional[Any])
identity (Optional[Any])
noLinkCheck (Optional[Any])
mapSubject (Optional[Any])
mapPredicate (Optional[Any])
refScope (Optional[Any])
typeDSL (Optional[Any])
secondaryFilesDSL (Optional[Any])
subscope (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.SpecializeDef(specializeFrom, specializeTo, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance80113f5fcc { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SpecializeDef" [URL="#schema_salad.metaschema.SpecializeDef",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"]; "Saveable" -> "SpecializeDef" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Mark classes than have a save() and fromDoc() function.
- Parameters:
specializeFrom (Any)
specializeTo (Any)
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.NamedType
Bases:
digraph inheritancebb9c2c4a34 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "NamedType" [URL="#schema_salad.metaschema.NamedType",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"]; "Saveable" -> "NamedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Saveable
Mark classes than have a save() and fromDoc() function.
- class schema_salad.metaschema.DocType
Bases:
digraph inheritance1fed15c982 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "DocType" [URL="#schema_salad.metaschema.DocType",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"]; "Documented" -> "DocType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Documented
Mark classes than have a save() and fromDoc() function.
- class schema_salad.metaschema.SchemaDefinedType
Bases:
digraph inheritanceb6322b30aa { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "DocType" [URL="#schema_salad.metaschema.DocType",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"]; "Documented" -> "DocType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaDefinedType" [URL="#schema_salad.metaschema.SchemaDefinedType",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="Abstract base for schema-defined types."]; "DocType" -> "SchemaDefinedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; }DocType
Abstract base for schema-defined types.
- class schema_salad.metaschema.SaladRecordField(name, type_, doc=None, jsonldPredicate=None, default=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritancea1b912dff2 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RecordField" [URL="#schema_salad.metaschema.RecordField",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 field of a record."]; "Documented" -> "RecordField" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SaladRecordField" [URL="#schema_salad.metaschema.SaladRecordField",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 field of a record."]; "RecordField" -> "SaladRecordField" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }RecordField
A field of a record.
- Parameters:
name (Any)
type_ (Any)
doc (Optional[Any])
jsonldPredicate (Optional[Any])
default (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.SaladRecordSchema(name, type_, inVocab=None, fields=None, doc=None, docParent=None, docChild=None, docAfter=None, jsonldPredicate=None, documentRoot=None, abstract=None, extends=None, specialize=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance3af8ae8c7e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "DocType" [URL="#schema_salad.metaschema.DocType",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"]; "Documented" -> "DocType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedType" [URL="#schema_salad.metaschema.NamedType",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"]; "Saveable" -> "NamedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RecordSchema" [URL="#schema_salad.metaschema.RecordSchema",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"]; "Saveable" -> "RecordSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SaladRecordSchema" [URL="#schema_salad.metaschema.SaladRecordSchema",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"]; "NamedType" -> "SaladRecordSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RecordSchema" -> "SaladRecordSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaDefinedType" -> "SaladRecordSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaDefinedType" [URL="#schema_salad.metaschema.SchemaDefinedType",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="Abstract base for schema-defined types."]; "DocType" -> "SchemaDefinedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; }NamedType
,RecordSchema
,SchemaDefinedType
Mark classes than have a save() and fromDoc() function.
- Parameters:
name (Any)
type_ (Any)
inVocab (Optional[Any])
fields (Optional[Any])
doc (Optional[Any])
docParent (Optional[Any])
docChild (Optional[Any])
docAfter (Optional[Any])
jsonldPredicate (Optional[Any])
documentRoot (Optional[Any])
abstract (Optional[Any])
extends (Optional[Any])
specialize (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.SaladEnumSchema(symbols, type_, name=None, inVocab=None, doc=None, docParent=None, docChild=None, docAfter=None, jsonldPredicate=None, documentRoot=None, extends=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance81f83ceda7 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "DocType" [URL="#schema_salad.metaschema.DocType",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"]; "Documented" -> "DocType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EnumSchema" [URL="#schema_salad.metaschema.EnumSchema",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="Define an enumerated type."]; "Saveable" -> "EnumSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedType" [URL="#schema_salad.metaschema.NamedType",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"]; "Saveable" -> "NamedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SaladEnumSchema" [URL="#schema_salad.metaschema.SaladEnumSchema",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="Define an enumerated type."]; "NamedType" -> "SaladEnumSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EnumSchema" -> "SaladEnumSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaDefinedType" -> "SaladEnumSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaDefinedType" [URL="#schema_salad.metaschema.SchemaDefinedType",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="Abstract base for schema-defined types."]; "DocType" -> "SchemaDefinedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; }NamedType
,EnumSchema
,SchemaDefinedType
Define an enumerated type.
- Parameters:
symbols (Any)
type_ (Any)
name (Optional[Any])
inVocab (Optional[Any])
doc (Optional[Any])
docParent (Optional[Any])
docChild (Optional[Any])
docAfter (Optional[Any])
jsonldPredicate (Optional[Any])
documentRoot (Optional[Any])
extends (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.SaladMapSchema(name, type_, values, inVocab=None, doc=None, docParent=None, docChild=None, docAfter=None, jsonldPredicate=None, documentRoot=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritanceb18bc14448 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "DocType" [URL="#schema_salad.metaschema.DocType",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"]; "Documented" -> "DocType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MapSchema" [URL="#schema_salad.metaschema.MapSchema",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"]; "Saveable" -> "MapSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedType" [URL="#schema_salad.metaschema.NamedType",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"]; "Saveable" -> "NamedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SaladMapSchema" [URL="#schema_salad.metaschema.SaladMapSchema",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="Define a map type."]; "NamedType" -> "SaladMapSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MapSchema" -> "SaladMapSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaDefinedType" -> "SaladMapSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SchemaDefinedType" [URL="#schema_salad.metaschema.SchemaDefinedType",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="Abstract base for schema-defined types."]; "DocType" -> "SchemaDefinedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; }NamedType
,MapSchema
,SchemaDefinedType
Define a map type.
- Parameters:
name (Any)
type_ (Any)
values (Any)
inVocab (Optional[Any])
doc (Optional[Any])
docParent (Optional[Any])
docChild (Optional[Any])
docAfter (Optional[Any])
jsonldPredicate (Optional[Any])
documentRoot (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.SaladUnionSchema(name, names, type_, inVocab=None, doc=None, docParent=None, docChild=None, docAfter=None, documentRoot=None, extension_fields=None, loadingOptions=None)
Bases:
digraph inheritance14f6e2c366 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "DocType" [URL="#schema_salad.metaschema.DocType",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"]; "Documented" -> "DocType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Documented" [URL="#schema_salad.metaschema.Documented",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"]; "Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedType" [URL="#schema_salad.metaschema.NamedType",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"]; "Saveable" -> "NamedType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SaladUnionSchema" [URL="#schema_salad.metaschema.SaladUnionSchema",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="Define a union type."]; "NamedType" -> "SaladUnionSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "UnionSchema" -> "SaladUnionSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DocType" -> "SaladUnionSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "UnionSchema" [URL="#schema_salad.metaschema.UnionSchema",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"]; "Saveable" -> "UnionSchema" [arrowsize=0.5,style="setlinewidth(0.5)"]; }NamedType
,UnionSchema
,DocType
Define a union type.
- Parameters:
name (Any)
names (Any)
type_ (Any)
inVocab (Optional[Any])
doc (Optional[Any])
docParent (Optional[Any])
docChild (Optional[Any])
docAfter (Optional[Any])
documentRoot (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- class schema_salad.metaschema.Documentation(name, type_, inVocab=None, doc=None, docParent=None, docChild=None, docAfter=None, extension_fields=None, loadingOptions=None)
-
digraph inheritancebe54ef369d {
bgcolor=transparent;
rankdir=LR;
size="8.0, 12.0";
"ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"];
"DocType" [URL="#schema_salad.metaschema.DocType",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"];
"Documented" -> "DocType" [arrowsize=0.5,style="setlinewidth(0.5)"];
"Documentation" [URL="#schema_salad.metaschema.Documentation",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 documentation section. This type exists to facilitate self-documenting"];
"NamedType" -> "Documentation" [arrowsize=0.5,style="setlinewidth(0.5)"];
"DocType" -> "Documentation" [arrowsize=0.5,style="setlinewidth(0.5)"];
"Documented" [URL="#schema_salad.metaschema.Documented",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"];
"Saveable" -> "Documented" [arrowsize=0.5,style="setlinewidth(0.5)"];
"NamedType" [URL="#schema_salad.metaschema.NamedType",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"];
"Saveable" -> "NamedType" [arrowsize=0.5,style="setlinewidth(0.5)"];
"Saveable" [URL="#schema_salad.metaschema.Saveable",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="Mark classes than have a save() and fromDoc() function."];
"ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"];
}
A documentation section. This type exists to facilitate self-documenting schemas but has no role in formal validation.
- Parameters:
name (Any)
type_ (Any)
inVocab (Optional[Any])
doc (Optional[Any])
docParent (Optional[Any])
docChild (Optional[Any])
docAfter (Optional[Any])
extension_fields (Optional[Dict[str, Any]])
loadingOptions (Optional[LoadingOptions])
- attrs
- classmethod fromDoc(doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- schema_salad.metaschema.strtype
- schema_salad.metaschema.inttype
- schema_salad.metaschema.floattype
- schema_salad.metaschema.booltype
- schema_salad.metaschema.None_type
- schema_salad.metaschema.Any_type
- schema_salad.metaschema.PrimitiveTypeLoader
Names of salad data types (based on Avro schema declarations).
Refer to the [Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for detailed information.
null: no value boolean: a binary value int: 32-bit signed integer long: 64-bit signed integer float: single precision (32-bit) IEEE 754 floating-point number double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence
- schema_salad.metaschema.AnyLoader
The Any type validates for any non-null value.
- schema_salad.metaschema.RecordFieldLoader
- schema_salad.metaschema.RecordSchemaLoader
- schema_salad.metaschema.EnumSchemaLoader
- schema_salad.metaschema.ArraySchemaLoader
- schema_salad.metaschema.MapSchemaLoader
- schema_salad.metaschema.UnionSchemaLoader
- schema_salad.metaschema.JsonldPredicateLoader
- schema_salad.metaschema.SpecializeDefLoader
- schema_salad.metaschema.SaladRecordFieldLoader
- schema_salad.metaschema.SaladRecordSchemaLoader
- schema_salad.metaschema.SaladEnumSchemaLoader
- schema_salad.metaschema.SaladMapSchemaLoader
- schema_salad.metaschema.SaladUnionSchemaLoader
- schema_salad.metaschema.DocumentationLoader
- schema_salad.metaschema.array_of_strtype
- schema_salad.metaschema.union_of_None_type_or_strtype_or_array_of_strtype
- schema_salad.metaschema.uri_strtype_True_False_None_None
- schema_salad.metaschema.union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype
- schema_salad.metaschema.array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype
- schema_salad.metaschema.union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype
- schema_salad.metaschema.typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2
- schema_salad.metaschema.array_of_RecordFieldLoader
- schema_salad.metaschema.union_of_None_type_or_array_of_RecordFieldLoader
- schema_salad.metaschema.idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader
- schema_salad.metaschema.Record_nameLoader
- schema_salad.metaschema.typedsl_Record_nameLoader_2
- schema_salad.metaschema.union_of_None_type_or_strtype
- schema_salad.metaschema.uri_union_of_None_type_or_strtype_True_False_None_None
- schema_salad.metaschema.uri_array_of_strtype_True_False_None_None
- schema_salad.metaschema.Enum_nameLoader
- schema_salad.metaschema.typedsl_Enum_nameLoader_2
- schema_salad.metaschema.uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None
- schema_salad.metaschema.Array_nameLoader
- schema_salad.metaschema.typedsl_Array_nameLoader_2
- schema_salad.metaschema.Map_nameLoader
- schema_salad.metaschema.typedsl_Map_nameLoader_2
- schema_salad.metaschema.Union_nameLoader
- schema_salad.metaschema.typedsl_Union_nameLoader_2
- schema_salad.metaschema.union_of_None_type_or_booltype
- schema_salad.metaschema.union_of_None_type_or_inttype
- schema_salad.metaschema.uri_strtype_False_False_1_None
- schema_salad.metaschema.uri_union_of_None_type_or_strtype_False_False_None_None
- schema_salad.metaschema.uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_None_None
- schema_salad.metaschema.union_of_None_type_or_strtype_or_JsonldPredicateLoader
- schema_salad.metaschema.union_of_None_type_or_Any_type
- schema_salad.metaschema.array_of_SaladRecordFieldLoader
- schema_salad.metaschema.union_of_None_type_or_array_of_SaladRecordFieldLoader
- schema_salad.metaschema.idmap_fields_union_of_None_type_or_array_of_SaladRecordFieldLoader
- schema_salad.metaschema.uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None
- schema_salad.metaschema.array_of_SpecializeDefLoader
- schema_salad.metaschema.union_of_None_type_or_array_of_SpecializeDefLoader
- schema_salad.metaschema.idmap_specialize_union_of_None_type_or_array_of_SpecializeDefLoader
- schema_salad.metaschema.Documentation_nameLoader
- schema_salad.metaschema.typedsl_Documentation_nameLoader_2
- schema_salad.metaschema.union_of_SaladRecordSchemaLoader_or_SaladEnumSchemaLoader_or_SaladMapSchemaLoader_or_SaladUnionSchemaLoader_or_DocumentationLoader
- schema_salad.metaschema.array_of_union_of_SaladRecordSchemaLoader_or_SaladEnumSchemaLoader_or_SaladMapSchemaLoader_or_SaladUnionSchemaLoader_or_DocumentationLoader
- schema_salad.metaschema.union_of_SaladRecordSchemaLoader_or_SaladEnumSchemaLoader_or_SaladMapSchemaLoader_or_SaladUnionSchemaLoader_or_DocumentationLoader_or_array_of_union_of_SaladRecordSchemaLoader_or_SaladEnumSchemaLoader_or_SaladMapSchemaLoader_or_SaladUnionSchemaLoader_or_DocumentationLoader
- schema_salad.metaschema.load_document(doc, baseuri=None, loadingOptions=None)
- Parameters:
doc (Any)
baseuri (Optional[str])
loadingOptions (Optional[LoadingOptions])
- Return type:
Any
- schema_salad.metaschema.load_document_with_metadata(doc, baseuri=None, loadingOptions=None, addl_metadata_fields=None)
- Parameters:
doc (Any)
baseuri (Optional[str])
loadingOptions (Optional[LoadingOptions])
addl_metadata_fields (Optional[MutableSequence[str]])
- Return type:
Any
- schema_salad.metaschema.load_document_by_string(string, uri, loadingOptions=None)
- Parameters:
string (Any)
uri (str)
loadingOptions (Optional[LoadingOptions])
- Return type:
Any
- schema_salad.metaschema.load_document_by_yaml(yaml, uri, loadingOptions=None)
Shortcut to load via a YAML object. yaml: must be from ruamel.yaml.main.YAML.load with preserve_quotes=True
- Parameters:
yaml (Any)
uri (str)
loadingOptions (Optional[LoadingOptions])
- Return type:
Any
schema_salad.python_codegen
Python code generator for a given schema salad definition.
Module Contents
Classes
Generation of Python code for a given Schema Salad definition. |
Functions
|
Use black to format this snippet. |
Attributes
- schema_salad.python_codegen.black
- schema_salad.python_codegen.prims
- schema_salad.python_codegen.fmt(text, indent)
Use black to format this snippet.
:param indent the indent level for the current context
- class schema_salad.python_codegen.PythonCodeGen(out, copyright, parser_info, salad_version)
Bases:
digraph inheritancefbba5b07c9 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="index.html#schema_salad.codegen_base.CodeGenBase",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="Abstract base class for schema salad code generators."]; "PythonCodeGen" [URL="#schema_salad.python_codegen.PythonCodeGen",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="Generation of Python code for a given Schema Salad definition."]; "CodeGenBase" -> "PythonCodeGen" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.codegen_base.CodeGenBase
Generation of Python code for a given Schema Salad definition.
- static safe_name(name)
Generate a safe version of the given name.
- prologue()
Trigger to generate the prolouge code.
- Return type:
None
- begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)
Produce the header for the given class.
- end_class(classname, field_names)
Signal that we are done with this class.
- type_loader(type_declaration, container=None, no_link_check=None)
Parse the given type declaration and declare its components.
- Parameters:
- Return type:
- declare_id_field(name, fieldtype, doc, optional)
Output the code to handle the given ID field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
- Return type:
None
- declare_field(name, fieldtype, doc, optional, subscope)
Output the code to load the given field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
subscope (Optional[str])
- Return type:
None
- uri_loader(inner, scoped_id, vocab_term, ref_scope, no_link_check=None)
Construct the TypeDef for the given URI loader.
- idmap_loader(field, inner, map_subject, map_predicate)
Construct the TypeDef for the given mapped ID loader.
- typedsl_loader(inner, ref_scope)
Construct the TypeDef for the given DSL loader.
- Parameters:
ref_scope (Optional[int])
- Return type:
- secondaryfilesdsl_loader(inner)
Construct the TypeDef for secondary files.
- Parameters:
- Return type:
- epilogue(root_loader)
Trigger to generate the epilouge code.
- Parameters:
root_loader (schema_salad.codegen_base.TypeDef)
- Return type:
None
schema_salad.python_codegen_support
Template code used by python_codegen.py.
Module Contents
Classes
Mark classes than have a save() and fromDoc() function. |
Functions
|
Load field. |
|
Take a type of value, and extracts the value as a string. |
|
Normalize type names to schema-salad types. |
|
Parse error messages from several loaders into one error message. |
|
|
|
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level. |
|
|
|
Transform a file path into a URL with file scheme. |
|
Expand short forms into full URLs using the given namespace dictionary. |
|
Convert any URI to a relative one, obeying the scoping rules. |
|
Compute the shortname of a fully qualified identifier. |
Attributes
- schema_salad.python_codegen_support.IdxType
- class schema_salad.python_codegen_support.LoadingOptions(fetcher=None, namespaces=None, schemas=None, fileuri=None, copyfrom=None, original_doc=None, addl_metadata=None, baseuri=None, idx=None, imports=None, includes=None, no_link_check=None, container=None)
- Parameters:
fetcher (Optional[schema_salad.fetcher.Fetcher])
schemas (Optional[List[str]])
fileuri (Optional[str])
copyfrom (Optional[LoadingOptions])
original_doc (Optional[Any])
baseuri (Optional[str])
idx (Optional[IdxType])
imports (Optional[List[str]])
includes (Optional[List[str]])
no_link_check (Optional[bool])
container (Optional[str])
- property graph: rdflib.Graph
Generate a merged rdflib.Graph from all entries in self.schemas.
- Return type:
- idx: IdxType
- fetcher: schema_salad.fetcher.Fetcher
- cache: schema_salad.utils.CacheType
- class schema_salad.python_codegen_support.Saveable
Bases:
digraph inheritance09618532e3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",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="Helper class that provides a standard way to create an ABC using"]; "Saveable" [URL="#schema_salad.python_codegen_support.Saveable",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="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }abc.ABC
Mark classes than have a save() and fromDoc() function.
- abstract classmethod fromDoc(_doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
_doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
- schema_salad.python_codegen_support.load_field(val, fieldtype, baseuri, loadingOptions, lc=None)
Load field.
- Parameters:
fieldtype (_Loader)
baseuri (str)
loadingOptions (LoadingOptions)
lc (Optional[List[Any]])
- Return type:
Any
- schema_salad.python_codegen_support.save_type
- schema_salad.python_codegen_support.extract_type(val_type)
Take a type of value, and extracts the value as a string.
- Parameters:
val_type (Type[Any])
- Return type:
- schema_salad.python_codegen_support.convert_typing(val_type)
Normalize type names to schema-salad types.
- schema_salad.python_codegen_support.parse_errors(error_message)
Parse error messages from several loaders into one error message.
- schema_salad.python_codegen_support.save(val, top=True, base_url='', relative_uris=True)
- schema_salad.python_codegen_support.save_with_metadata(val, valLoadingOpts, top=True, base_url='', relative_uris=True)
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level.
- Parameters:
val (Any)
valLoadingOpts (LoadingOptions)
top (bool)
base_url (str)
relative_uris (bool)
- Return type:
save_type
- schema_salad.python_codegen_support.expand_url(url, base_url, loadingOptions, scoped_id=False, vocab_term=False, scoped_ref=None)
- schema_salad.python_codegen_support.file_uri(path, split_frag=False)
Transform a file path into a URL with file scheme.
- schema_salad.python_codegen_support.prefix_url(url, namespaces)
Expand short forms into full URLs using the given namespace dictionary.
- schema_salad.python_codegen_support.save_relative_uri(uri, base_url, scoped_id, ref_scope, relative_uris)
Convert any URI to a relative one, obeying the scoping rules.
- schema_salad.python_codegen_support.shortname(inputid)
Compute the shortname of a fully qualified identifier.
schema_salad.ref_resolver
Module Contents
Classes
A Dict where all keys are normalized using the provided function. |
|
Functions
|
|
|
|
Convert ruamel.yaml exception to our type. |
|
|
- schema_salad.ref_resolver.file_uri(path, split_frag=False)
- 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"; "Dict" [URL="https://docs.python.org/3/library/typing.html#typing.Dict",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"]; "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" -> "NormDict" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Dict
[str
,Union
[ruamel.yaml.comments.CommentedMap
,ruamel.yaml.comments.CommentedSeq
,str
,None
]]A Dict where all keys are normalized using the provided function.
- __getitem__(key)
x.__getitem__(y) <==> x[y]
- 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:
- __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])
salad_version (Optional[str])
- expand_url(url, base_url, scoped_id=False, vocab_term=False, scoped_ref=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)
- resolve_all(document, base_url, file_base=None, checklinks=True, strict_foreign_properties=False)
- fetch(url, inject_ids=True, content_types=None)
- validate_scoped(field, link, docid)
- validate_link(field, link, docid, all_doc_ids)
schema_salad.schema
Functions to process Schema Salad schemas.
Module Contents
Functions
Instantiate the metaschema. |
|
|
Collect the provided namespaces, checking for conflicts. |
|
Walk through the metadata object, collecting namespace declarations. |
|
Load a schema that can be used to validate documents using load_and_validate. |
|
Load a document and validate it with the provided schema. |
|
Validate a document using the provided schema. |
|
Calculate a reproducible name for anonymous types. |
|
Go through and replace types in the 'spec' mapping. |
|
Turn a URL into an Avro-safe name. |
|
Convert our schema to be more avro like. |
|
Make a deep copy of list and dict objects. |
|
Apply 'extend' and 'specialize' to fully materialize derived record types. |
|
|
|
All in one convenience function. |
|
Return the last segment of the provided fragment or path. |
|
Write a Grapviz inheritance graph for the supplied document. |
|
Write a GraphViz graph of the relationships between the fields. |
Attributes
- schema_salad.schema.SALAD_FILES = ('metaschema.yml', 'metaschema_base.yml', 'salad.md', 'field_name.yml', 'import_include.md',...
- schema_salad.schema.saladp = 'https://w3id.org/cwl/salad#'
- schema_salad.schema.cached_metaschema: Tuple[schema_salad.avro.schema.Names, List[Dict[str, str]], schema_salad.ref_resolver.Loader] | None
- schema_salad.schema.get_metaschema()
Instantiate the metaschema.
- Return type:
Tuple[schema_salad.avro.schema.Names, List[Dict[str, str]], schema_salad.ref_resolver.Loader]
- schema_salad.schema.add_namespaces(metadata, namespaces)
Collect the provided namespaces, checking for conflicts.
- schema_salad.schema.collect_namespaces(metadata)
Walk through the metadata object, collecting namespace declarations.
- schema_salad.schema.schema_type
- schema_salad.schema.load_schema(schema_ref, cache=None)
Load a schema that can be used to validate documents using load_and_validate.
- Returns:
document_loader, avsc_names, schema_metadata, metaschema_loader
- Parameters:
schema_ref (schema_salad.utils.ResolveType)
cache (Optional[schema_salad.utils.CacheType])
- Return type:
schema_type
- schema_salad.schema.load_and_validate(document_loader, avsc_names, document, strict, strict_foreign_properties=False)
Load a document and validate it with the provided schema.
return data, metadata
- Parameters:
document_loader (schema_salad.ref_resolver.Loader)
avsc_names (schema_salad.avro.schema.Names)
document (Union[ruamel.yaml.comments.CommentedMap, str])
strict (bool)
strict_foreign_properties (bool)
- Return type:
Tuple[Any, Dict[str, Any]]
- schema_salad.schema.validate_doc(schema_names, doc, loader, strict, strict_foreign_properties=False)
Validate a document using the provided schema.
- Parameters:
schema_names (schema_salad.avro.schema.Names)
doc (schema_salad.utils.ResolveType)
loader (schema_salad.ref_resolver.Loader)
strict (bool)
strict_foreign_properties (bool)
- Return type:
None
- schema_salad.schema.get_anon_name(rec)
Calculate a reproducible name for anonymous types.
- schema_salad.schema.replace_type(items, spec, loader, found, find_embeds=True, deepen=True)
Go through and replace types in the ‘spec’ mapping.
- Parameters:
items (Any)
spec (Dict[str, Any])
loader (schema_salad.ref_resolver.Loader)
found (Set[str])
find_embeds (bool)
deepen (bool)
- Return type:
Any
- schema_salad.schema.avro_field_name(url)
Turn a URL into an Avro-safe name.
If the URL has no fragment, return this plain URL.
Extract either the last part of the URL fragment past the slash, otherwise the whole fragment.
- schema_salad.schema.Avro
- schema_salad.schema.make_valid_avro(items, alltypes, found, union=False, fielddef=False, vocab=None)
Convert our schema to be more avro like.
- schema_salad.schema.deepcopy_strip(item)
Make a deep copy of list and dict objects.
Intentionally do not copy attributes. This is to discard CommentedMap and CommentedSeq metadata which is very expensive with regular copy.deepcopy.
- Parameters:
item (Any)
- Return type:
Any
- schema_salad.schema.extend_and_specialize(items, loader)
Apply ‘extend’ and ‘specialize’ to fully materialize derived record types.
- Parameters:
items (List[Dict[str, Any]])
loader (schema_salad.ref_resolver.Loader)
- Return type:
List[Dict[str, Any]]
- schema_salad.schema.make_avro(i, loader, metaschema_vocab=None)
- Parameters:
i (List[Dict[str, Any]])
loader (schema_salad.ref_resolver.Loader)
- Return type:
List[Any]
- schema_salad.schema.make_avro_schema(i, loader, metaschema_vocab=None)
All in one convenience function.
Call make_avro() and make_avro_schema_from_avro() separately if you need the intermediate result for diagnostic output.
- Parameters:
i (List[Any])
loader (schema_salad.ref_resolver.Loader)
- Return type:
- schema_salad.schema.make_avro_schema_from_avro(avro)
- Parameters:
- Return type:
- schema_salad.schema.shortname(inputid)
Return the last segment of the provided fragment or path.
- schema_salad.schema.print_inheritance(doc, stream)
Write a Grapviz inheritance graph for the supplied document.
- Parameters:
doc (List[Dict[str, Any]])
stream (IO[Any])
- Return type:
None
- schema_salad.schema.print_fieldrefs(doc, loader, stream)
Write a GraphViz graph of the relationships between the fields.
- Parameters:
doc (List[Dict[str, Any]])
loader (schema_salad.ref_resolver.Loader)
stream (IO[Any])
- Return type:
None
schema_salad.sourceline
Module Contents
Classes
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
Strip duplicated line numbers. |
|
|
|
Attributes
- schema_salad.sourceline.lineno_re
- schema_salad.sourceline.add_lc_filename(r, source)
- Parameters:
r (ruamel.yaml.comments.CommentedBase)
source (str)
- Return type:
None
- schema_salad.sourceline.reflow_all(text, maxline=None)
- schema_salad.sourceline.reflow(text, maxline, shift='')
- schema_salad.sourceline.indent(v, nolead=False, shift=' ', bullet=' ')
- schema_salad.sourceline.bullets(textlist, bul)
- schema_salad.sourceline.strip_duplicated_lineno(text)
Strip duplicated line numbers.
Same as
strip_dup_lineno()
but without reflow.
- schema_salad.sourceline.strip_dup_lineno(text, maxline=None)
- schema_salad.sourceline.cmap(d, lc=None, fn=None)
schema_salad.typescript_codegen
TypeScript code generator for a given schema salad definition.
Module Contents
Classes
Generation of TypeScript code for a given Schema Salad definition. |
Functions
|
Generate a documentation string from a schema salad doc field. |
Attributes
- schema_salad.typescript_codegen.doc_to_doc_string(doc, indent_level=0)
Generate a documentation string from a schema salad doc field.
- schema_salad.typescript_codegen.prims
- class schema_salad.typescript_codegen.TypeScriptCodeGen(base, examples, target, package)
Bases:
digraph inheritancea17bceb82d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="index.html#schema_salad.codegen_base.CodeGenBase",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="Abstract base class for schema salad code generators."]; "TypeScriptCodeGen" [URL="#schema_salad.typescript_codegen.TypeScriptCodeGen",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="Generation of TypeScript code for a given Schema Salad definition."]; "CodeGenBase" -> "TypeScriptCodeGen" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.codegen_base.CodeGenBase
Generation of TypeScript code for a given Schema Salad definition.
- prologue()
Trigger to generate the prolouge code.
- Return type:
None
- static safe_name(name)
Generate a safe version of the given name.
- begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)
Produce the header for the given class.
- end_class(classname, field_names)
Signal that we are done with this class.
- type_loader(type_declaration, container=None, no_link_check=None)
Parse the given type declaration and declare its components.
- Parameters:
- Return type:
- declare_field(name, fieldtype, doc, optional, subscope)
Output the code to load the given field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
subscope (Optional[str])
- Return type:
None
- declare_id_field(name, fieldtype, doc, optional)
Output the code to handle the given ID field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
- Return type:
None
- to_typescript(val)
Convert a Python keyword to a TypeScript keyword.
- Parameters:
val (Any)
- Return type:
Any
- uri_loader(inner, scoped_id, vocab_term, ref_scope, no_link_check=None)
Construct the TypeDef for the given URI loader.
- idmap_loader(field, inner, map_subject, map_predicate)
Construct the TypeDef for the given mapped ID loader.
- typedsl_loader(inner, ref_scope)
Construct the TypeDef for the given DSL loader.
- Parameters:
ref_scope (Optional[int])
- Return type:
- epilogue(root_loader)
Trigger to generate the epilouge code.
- Parameters:
root_loader (schema_salad.codegen_base.TypeDef)
- Return type:
None
- secondaryfilesdsl_loader(inner)
Construct the TypeDef for secondary files.
- Parameters:
- Return type:
schema_salad.utils
schema_salad.validate
Module Contents
Functions
|
|
|
Produce an avro friendly short name. |
|
Turn a URL into an Avro-safe name. |
|
Format an Avro schema into a pretty-printed representation. |
|
Truncate a pretty-printed representation of a Python object to 160 characters. |
|
Determine if a python datum is an instance of a schema. |
Attributes
- schema_salad.validate.validate(expected_schema, datum, identifiers=None, strict=False, foreign_properties=None, vocab=None)
- schema_salad.validate.INT_MIN_VALUE
- schema_salad.validate.INT_MAX_VALUE
- schema_salad.validate.LONG_MIN_VALUE
- schema_salad.validate.LONG_MAX_VALUE
- schema_salad.validate.avro_shortname(name)
Produce an avro friendly short name.
- schema_salad.validate.saladp = 'https://w3id.org/cwl/salad#'
- schema_salad.validate.primitives
- schema_salad.validate.avro_type_name(url)
Turn a URL into an Avro-safe name.
If the URL has no fragment, return this plain URL.
Extract either the last part of the URL fragment past the slash, otherwise the whole fragment.
- schema_salad.validate.friendly(v)
Format an Avro schema into a pretty-printed representation.
- Parameters:
v (Any)
- Return type:
Any
- schema_salad.validate.vpformat(datum)
Truncate a pretty-printed representation of a Python object to 160 characters.
- Parameters:
datum (Any)
- Return type:
- schema_salad.validate.validate_ex(expected_schema, datum, identifiers=None, strict=False, foreign_properties=None, raise_ex=True, strict_foreign_properties=False, logger=_logger, skip_foreign_properties=False, vocab=None)
Determine if a python datum is an instance of a schema.
- Parameters:
expected_schema (schema_salad.avro.schema.Schema)
datum (Any)
identifiers (Optional[List[str]])
strict (bool)
foreign_properties (Optional[Set[str]])
raise_ex (bool)
strict_foreign_properties (bool)
logger (logging.Logger)
skip_foreign_properties (bool)
- Return type:
Package Contents
- schema_salad.__author__ = 'peter.amstutz@curoverse.com'