schema_salad.makedoc

Attributes

PluginName

basicTypes

Exceptions

SchemaSaladException

Base class for all schema-salad exceptions.

ValidationException

Indicates error with document against the provided schema.

Classes

MyRenderer

Custom renderer with different representations of selected HTML tags.

ToC

RenderType

Functions

avro_field_name(url)

Turn a URL into an Avro-safe name.

extend_and_specialize(items, loader)

Apply 'extend' and 'specialize' to fully materialize derived record types.

get_metaschema()

Instantiate the metaschema.

add_dictlist(di, key, val)

Manage element insertion in dicts of lists.

aslist(thing)

Wrap single items and lists.

avro_type_name(url)

Turn a URL into an Avro-safe name.

escape_html(s)

Escape HTML but otherwise preserve single quotes.

vocab_type_name(url)

Remove the avro namespace, if any.

has_types(items)

linkto(item)

patch_fenced_code(original_markdown_text, ...)

Reverts fenced code fragments found in the modified contents back to their original definition.

to_id(text)

number_headings(toc, maindoc)

fix_doc(doc)

avrold_doc(j, outdoc, renderlist, redirects, brand, ...)

arg_parser()

Build the argument parser.

main()

Shortcut entrypoint.

makedoc(stdout, schema[, redirects, only, brand, ...])

Emit HTML representation of a given schema.

Module Contents

exception schema_salad.makedoc.SchemaSaladException(msg, sl=None, children=None, bullet_for_children='')

Bases: Exception

digraph inheritance624799ba9a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "SchemaSaladException" [URL="../exceptions/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."]; }

Base class for all schema-salad exceptions.

Parameters:
propagate_sourceline()
Return type:

None

as_warning()
Return type:

SchemaSaladException

with_sourceline(sl)
Parameters:

sl (Optional[schema_salad.sourceline.SourceLine])

Return type:

SchemaSaladException

leaves()
Return type:

List[SchemaSaladException]

prefix()
Return type:

str

summary(level=0, with_bullet=False)
Parameters:
Return type:

str

__str__()

Convert to a string using pretty_str().

Return type:

str

pretty_str(level=0)
Parameters:

level (int)

Return type:

str

exception schema_salad.makedoc.ValidationException(msg, sl=None, children=None, bullet_for_children='')

Bases: SchemaSaladException

digraph inheritance7e96dd18d3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "SchemaSaladException" [URL="../exceptions/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."]; "ValidationException" [URL="../exceptions/index.html#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)"]; }

Indicates error with document against the provided schema.

Parameters:
schema_salad.makedoc.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.

Parameters:

url (str)

Return type:

str

schema_salad.makedoc.extend_and_specialize(items, loader)

Apply ‘extend’ and ‘specialize’ to fully materialize derived record types.

Parameters:
Return type:

List[Dict[str, Any]]

schema_salad.makedoc.get_metaschema()

Instantiate the metaschema.

Return type:

Tuple[schema_salad.avro.schema.Names, List[Dict[str, str]], schema_salad.ref_resolver.Loader]

schema_salad.makedoc.add_dictlist(di, key, val)

Manage element insertion in dicts of lists.

Parameters:
  • di (Dict[Any, Any])

  • key (Any)

  • val (Any)

Return type:

None

schema_salad.makedoc.aslist(thing)

Wrap single items and lists.

Return lists unchanged.

Parameters:

thing (Any)

Return type:

MutableSequence[Any]

schema_salad.makedoc.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.

Parameters:

url (str)

Return type:

str

schema_salad.makedoc.PluginName
schema_salad.makedoc.escape_html(s)

Escape HTML but otherwise preserve single quotes.

Parameters:

s (str)

Return type:

str

schema_salad.makedoc.vocab_type_name(url)

Remove the avro namespace, if any.

Parameters:

url (str)

Return type:

str

schema_salad.makedoc.has_types(items)
Parameters:

items (Any)

Return type:

List[str]

schema_salad.makedoc.linkto(item)
Parameters:

item (str)

Return type:

str

class schema_salad.makedoc.MyRenderer(escape=True, allow_harmful_protocols=None)

Bases: mistune.renderers.html.HTMLRenderer

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)"]; }

Custom renderer with different representations of selected HTML tags.

heading(text, level, **attrs)

Override HTML heading creation with text IDs.

Parameters:
  • text (str)

  • level (int)

  • attrs (Any)

Return type:

str

text(text)

Don’t escape quotation marks.

Parameters:

text (str)

Return type:

str

inline_html(html)

Don’t escape characters in predefined HTML within paragraph tags.

Parameters:

html (str)

Return type:

str

block_html(html)

Don’t escape characters nor wrap predefined HTML within paragraph tags.

Parameters:

html (str)

Return type:

str

block_code(code, info=None)

Don’t escape quotation marks.

Parameters:
  • code (str)

  • info (Optional[str])

Return type:

str

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.

Parameters:
  • original_markdown_text (str)

  • modified_markdown_text (str)

Return type:

str

schema_salad.makedoc.to_id(text)
Parameters:

text (str)

Return type:

str

class schema_salad.makedoc.ToC
add_entry(thisdepth, title)

Add an entry to the table of contents.

Parameters:
Return type:

str

contents(idn)
Parameters:

idn (str)

Return type:

str

schema_salad.makedoc.basicTypes = ('https://w3id.org/cwl/salad#null', 'http://www.w3.org/2001/XMLSchema#boolean',...
schema_salad.makedoc.number_headings(toc, maindoc)
Parameters:
Return type:

str

schema_salad.makedoc.fix_doc(doc)
Parameters:

doc (Union[List[str], str])

Return type:

str

class schema_salad.makedoc.RenderType(toc, j, renderlist, redirects, primitiveType)
Parameters:
  • toc (ToC)

  • j (List[Dict[str, Any]])

  • renderlist (List[str])

  • redirects (Dict[str, str])

  • primitiveType (str)

typefmt(tp, redirects, nbsp=False, jsonldPredicate=None)
Parameters:
  • tp (Any)

  • redirects (Dict[str, str])

  • nbsp (bool)

  • jsonldPredicate (Optional[Union[Dict[str, str], str]])

Return type:

str

render_type(f, depth)
Parameters:
  • f (Dict[str, Any])

  • depth (int)

Return type:

None

schema_salad.makedoc.avrold_doc(j, outdoc, renderlist, redirects, brand, brandlink, primtype, brandstyle=None, brandinverse=False)
Parameters:
  • j (List[Dict[str, Any]])

  • outdoc (IO[Any])

  • renderlist (List[str])

  • redirects (Dict[str, str])

  • brand (str)

  • brandlink (str)

  • primtype (str)

  • brandstyle (Optional[str])

  • brandinverse (Optional[bool])

Return type:

None

schema_salad.makedoc.arg_parser()

Build the argument parser.

Return type:

argparse.ArgumentParser

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.

Parameters:
  • stdout (IO[Any])

  • schema (str)

  • redirects (Optional[List[str]])

  • only (Optional[List[str]])

  • brand (Optional[str])

  • brandlink (Optional[str])

  • primtype (Optional[str])

  • brandstyle (Optional[str])

  • brandinverse (Optional[bool])

Return type:

None