SerializationOptions

class SerializationOptions

Options for SysML model serialization. Attribute options are ordered in descending precedence.

Members defined in SerializationOptions (11 members)

fail_action

RW

Action to take on serialization errors.

filter

RW

Filter expression evaluation function.

include_default

RW

If true, serialize attributes even if they match their default values.

include_derived

RW

If true, serialize derived attributes. Corresponds to includesDerived flag in the specification (KerML 10.3, Table 13):

include_implied

RW

If true, serialize implicit elements. Only for attributes that are serialized. Corresponds to includesImplied flag in the specification (KerML 10.3, Table 13):

include_optional

RW

If true, non-required attributes will be serialized even if they are null or empty.

include_redefined

RW

If true, serialize attributes even if they are redefined in the metamodel.

use_standard_names

RW

If true, fields will be serialized using standard names

__init__

minimal

Configuration that instructs the writer to produce a minimal JSON without any redundant elements. Examples of redundant information that is avoided using the minimal configuration are:

with_options

Creates a copy with the specified options changed to the given values.

Attributes

property fail_action: syside.FailAction

Action to take on serialization errors.

property filter: Callable[[syside.Element, list[syside.Expression]], bool] | None

Filter expression evaluation function.

If not set, filter expressions will not be evaluated. Do not note that filter expressions may be evaluated multiple times on each applicable element when serializing derived properties as some overlap considerably.

property include_default: bool

If true, serialize attributes even if they match their default values.

property include_derived: bool

If true, serialize derived attributes. Corresponds to includesDerived flag in the specification (KerML 10.3, Table 13):

Whether derived property values are included in the model interchange files.

Note: Syside does not construct all derived properties yet. Therefore, setting options.include_derived to True may result in a JSON that does not satisfy the schema.

property include_implied: bool

If true, serialize implicit elements. Only for attributes that are serialized. Corresponds to includesImplied flag in the specification (KerML 10.3, Table 13):

Whether implied relationships are included in the model interchange files.

property include_optional: bool

If true, non-required attributes will be serialized even if they are null or empty.

property include_redefined: bool

If true, serialize attributes even if they are redefined in the metamodel.

property use_standard_names: bool

If true, fields will be serialized using standard names

Methods

__init__(use_standard_names: bool = True, include_derived: bool = False, include_redefined: bool = False, include_default: bool = False, include_optional: bool = False, include_implied: bool = False, fail_action: syside.FailAction = FailAction.Diagnose, filter: syside.CompilerFilter | Callable[[syside.Element, list[syside.Expression]], bool] | None = None) None
static minimal() syside.SerializationOptions

Configuration that instructs the writer to produce a minimal JSON without any redundant elements. Examples of redundant information that is avoided using the minimal configuration are:

  • including fields for null values;

  • including fields whose values match the default values;

  • including redefined fields that are duplicates of redefining fields;

  • including derived fields that can be computed from minimal JSON (for example, the result value of evaluating an expression);

  • including implied relationships.

with_options(use_standard_names: bool | None = None, include_derived: bool | None = None, include_redefined: bool | None = None, include_default: bool | None = None, include_optional: bool | None = None, include_implied: bool | None = None, filter: syside.CompilerFilter | Callable[[syside.Element, list[syside.Expression]], bool] | None = None, fail_action: syside.FailAction | None = None) syside.SerializationOptions

Creates a copy with the specified options changed to the given values.

Used in