schema_salad.dlang_codegen
==========================

.. py:module:: schema_salad.dlang_codegen

.. autoapi-nested-parse::

   D code generator for a given schema salad definition.



Classes
-------

.. autoapisummary::

   schema_salad.dlang_codegen.DlangCodeGen


Functions
---------

.. autoapisummary::

   schema_salad.dlang_codegen.is_constant_field
   schema_salad.dlang_codegen.constant_fields_of
   schema_salad.dlang_codegen.are_dispatchable


Module Contents
---------------

.. py:class:: DlangCodeGen(base, target, examples, package, copyright_, parser_info, salad_version)

   Bases: :py:obj:`schema_salad.codegen_base.CodeGenBase`

   .. autoapi-inheritance-diagram:: schema_salad.dlang_codegen.DlangCodeGen
      :parts: 1


   Generation of D code for a given Schema Salad definition.


   .. py:attribute:: base_uri


   .. py:attribute:: examples


   .. py:attribute:: target


   .. py:attribute:: package


   .. py:attribute:: copyright


   .. py:attribute:: parser_info


   .. py:attribute:: salad_version


   .. py:attribute:: doc_root_types
      :type:  list[str]
      :value: []



   .. py:method:: prologue()

      Trigger to generate the prolouge code.



   .. py:method:: epilogue(root_loader)

      Trigger to generate the epilouge code.



   .. py:method:: safe_name(name)
      :staticmethod:


      Generate a safe version of the given name.



   .. py:method:: to_doc_comment(doc)

      Return an embedded documentation comments for a given string.



   .. py:method:: parse_record_field_type(type_, jsonld_pred, parent_has_idmap = False, has_default = False)

      Return an annotation string and a type string.



   .. py:method:: parse_record_field(field, parent_name = None)

      Return a declaration string for a given record field.



   .. py:method:: parse_record_schema(stype)

      Return a declaration string for a given record schema.



   .. py:method:: parse_enum(stype)

      Return a declaration string for a given enum schema.



   .. py:method:: parse_union(stype)

      Return a declaration string for a given union schema.



   .. py:method:: parse_map(stype)

      Return a declaration string for a given map schema.



   .. py:method:: parse(items)

      Generate D code from items and write it to target.



.. py:function:: is_constant_field(field)

   Return True if a given field only takes the specified string.


.. py:function:: constant_fields_of(type_)

   Return a list of constant fields name from a given record schema.


.. py:function:: are_dispatchable(types, parent_has_idmap)

   Return True if a given list of types are dispatchable.


