syside.SerializationOptions

class SerializationOptions(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)

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

Initialization

property use_standard_names: bool

If true, fields will be serialized using standard names

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_redefined: bool

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

property include_default: bool

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

property include_optional: bool

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

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 fail_action: syside.FailAction

Action to take on serialization errors.

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) syside.SerializationOptions

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