Skip to content

Builder Configuration

Daniel Carbone edited this page Jan 16, 2025 · 4 revisions

Options

These are the configuration options available when generating code using the Builder

Option Type Description
outputPath boolean (Required) Root output directory for all generated code.
rootNamespace boolean (Required) Root namespace for all generated code.
versions iterable of assoc. arrays (Required) Configuration of each version you wish to generate
libxmlOpts int (Optional) Option mask of libxml options to use when parsing version schema .xsd files.

Version Configuration

The versions configuration key must be defined as either an array of associative arrays, or an array of objects.

Options

These options are used when generating code for a particular FHIR version.

Option Type Description
name string (Required) Unique name for version.
schemaPath string (Required) Fully qualified path to directory containing version schema .xsd files. The generator does NOT recurse into sub-directories.
namespace string (Optional) Namespace for version. This is nested under the $rootNamespace\\Versions. If not set, name value will be used if it is a valid PHP namespace key.
defaultConfig assoc. array (Optional) Default configuration options for the generated code. These options may be overridden at runtime.

Default Configuration

These options are set as the defaults for a particular generated version's code. They may be overridden at runtime when using the code.

Option Type Description
unserializeConfig assoc. array (Optional) Configuration to use when unserializing from JSON or XML into modeled types.
serializeConfig assoc. array (Optional) Configuration to use when serializing from modeled types into JSON or XML.

Unserialization Options

These are the default options that the generated code for a given version will use when unserializing from XML or JSON. You may override these values at runtime.

Option Type Description
libxmlOpts integer (Optional) Option mask of libxml options to use when unserializing types from XML. Mutually exclusive with libxmlOptMask.
libxmlOptMask string (Optional) String value of libxml options. Can result in "prettier" generated output. Mutually exclusive with libxmlOpts.
jsonDecodeMaxDepth integer (Optional) Maximum depth to decode JSON objects. Defaults to language default.

Serialization Options

These options are set as the defaults for a particular generated version's code. They may be overridden at runtime when using the code.

Option Type Description
overrideSourceXMLNS boolean (Optional) If true, will override the XMLNS parsed from the source when unserializing XML with the value provided to rootXMLNS.
rootXMLNS string (Optional) XMLNS value to use when serializing to XML. Will always be used if source did not contain XMLNS, or if overrideSourceXMLNS is true. Required if overrideSourceXMLNS is true.

Example

You can find an example configuration map in bin/config.php.