schema_salad.dotnet_codegen

DotNet code generator for a given schema salad definition.

Module Contents

Classes

DotNetCodeGen

Generation of TypeScript code for a given Schema Salad definition.

Functions

doc_to_doc_string(doc[, indent_level])

Generate a documentation string from a schema salad doc field.

Attributes

prims

schema_salad.dotnet_codegen.doc_to_doc_string(doc, indent_level=0)

Generate a documentation string from a schema salad doc field.

Parameters:
  • doc (Optional[str]) –

  • indent_level (int) –

Return type:

str

schema_salad.dotnet_codegen.prims
class schema_salad.dotnet_codegen.DotNetCodeGen(base, examples, target, package)

Bases: schema_salad.codegen_base.CodeGenBase

digraph inheritancee100b2d656 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="../codegen_base/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)"]; }

Generation of TypeScript code for a given Schema Salad definition.

Parameters:
  • base (str) –

  • examples (Optional[str]) –

  • target (Optional[str]) –

  • package (str) –

prologue()

Trigger to generate the prolouge code.

Return type:

None

static safe_name(name)

Generate a safe version of the given name.

Parameters:

name (str) –

Return type:

str

begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)

Produce the header for the given class.

Parameters:
  • classname (str) –

  • extends (MutableSequence[str]) –

  • doc (str) –

  • abstract (bool) –

  • field_names (MutableSequence[str]) –

  • idfield (str) –

  • optional_fields (Set[str]) –

Return type:

None

end_class(classname, field_names)

Signal that we are done with this class.

Parameters:
  • classname (str) –

  • field_names (List[str]) –

Return type:

None

type_loader(type_declaration, container=None, no_link_check=None)

Parse the given type declaration and declare its components.

Parameters:
  • type_declaration (Union[List[Any], Dict[str, Any], str]) –

  • container (Optional[str]) –

  • no_link_check (Optional[bool]) –

Return type:

schema_salad.codegen_base.TypeDef

type_loader_enum(type_declaration)
Parameters:

type_declaration (Dict[str, Any]) –

Return type:

schema_salad.codegen_base.TypeDef

declare_field(name, fieldtype, doc, optional, subscope)

Output the code to load the given field.

Parameters:
Return type:

None

declare_id_field(name, fieldtype, doc, optional)

Output the code to handle the given ID field.

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

Parameters:
Return type:

schema_salad.codegen_base.TypeDef

idmap_loader(field, inner, map_subject, map_predicate)

Construct the TypeDef for the given mapped ID loader.

Parameters:
Return type:

schema_salad.codegen_base.TypeDef

typedsl_loader(inner, ref_scope)

Construct the TypeDef for the given DSL loader.

Parameters:
Return type:

schema_salad.codegen_base.TypeDef

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:

inner (schema_salad.codegen_base.TypeDef) –

Return type:

schema_salad.codegen_base.TypeDef