<?hh
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

namespace test\fixtures\patch;

/**
 * Original thrift enum:-
 * MyEnum
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyEnum'))>>
enum MyEnum: int {
  MyValue0 = 0;
}

class MyEnum_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.MyEnum",
        "elements" => dict[
          0 => "MyValue0",
        ],
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TEnumAnnotations {
    return shape(
      'enum' => dict[],
      'constants' => dict[
      ],
    );
  }
}

/**
 * Original thrift struct:-
 * MyData
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyData'))>>
class MyData implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'data1',
      'is_terse' => true,
      'type' => \TType::STRING,
    ),
    2 => shape(
      'var' => 'data2',
      'is_terse' => true,
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'data1' => 1,
    'data2' => 2,
  ];

  const type TConstructorShape = shape(
    ?'data1' => ?string,
    ?'data2' => ?int,
  );

  const type TShape = shape(
    'data1' => string,
    'data2' => int,
    ...
  );
  const int STRUCTURAL_ID = 5497211930825790974;
  /**
   * Original thrift field:-
   * 1: string data1
   */
  public string $data1;
  /**
   * Original thrift field:-
   * 2: i32 data2
   */
  public int $data2;

  public function __construct(?string $data1 = null, ?int $data2 = null)[] {
    $this->data1 = $data1 ?? '';
    $this->data2 = $data2 ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'data1'),
      Shapes::idx($shape, 'data2'),
    );
  }

  public function getName()[]: string {
    return 'MyData';
  }

  public function clearTerseFields()[write_props]: void {
    $this->data1 = '';
    $this->data2 = 0;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyData",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "data1",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "data2",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      $shape['data1'],
      $shape['data2'],
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'data1' => $this->data1,
      'data2' => $this->data2,
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'data1') !== null) {
      $this->data1 = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['data1']);
    }
    if (idx($parsed, 'data2') !== null) {
      $_tmp0 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['data2']);
      if ($_tmp0 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->data2 = (int)$_tmp0;
      }
    }
  }

}

/**
 * Original thrift struct:-
 * MyDataWithCustomDefault
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyDataWithCustomDefault'))>>
class MyDataWithCustomDefault implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'data1',
      'is_terse' => true,
      'type' => \TType::STRING,
    ),
    2 => shape(
      'var' => 'data2',
      'is_terse' => true,
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'data1' => 1,
    'data2' => 2,
  ];

  const type TConstructorShape = shape(
    ?'data1' => ?string,
    ?'data2' => ?int,
  );

  const type TShape = shape(
    'data1' => string,
    'data2' => int,
    ...
  );
  const int STRUCTURAL_ID = 5497211930825790974;
  /**
   * Original thrift field:-
   * 1: string data1
   */
  public string $data1;
  /**
   * Original thrift field:-
   * 2: i32 data2
   */
  public int $data2;

  public function __construct(?string $data1 = null, ?int $data2 = null)[] {
    $this->data1 = $data1 ?? "1";
    $this->data2 = $data2 ?? 2;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'data1'),
      Shapes::idx($shape, 'data2'),
    );
  }

  public function getName()[]: string {
    return 'MyDataWithCustomDefault';
  }

  public function clearTerseFields()[write_props]: void {
    $this->data1 = '';
    $this->data2 = 0;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyDataWithCustomDefault",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "data1",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "data2",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      $shape['data1'],
      $shape['data2'],
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'data1' => $this->data1,
      'data2' => $this->data2,
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'data1') !== null) {
      $this->data1 = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['data1']);
    }
    if (idx($parsed, 'data2') !== null) {
      $_tmp0 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['data2']);
      if ($_tmp0 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->data2 = (int)$_tmp0;
      }
    }
  }

}

enum InnerUnionEnum: int {
  _EMPTY_ = 0;
  innerOption = 1;
}

/**
 * Original thrift struct:-
 * InnerUnion
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/InnerUnion'))>>
class InnerUnion implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftUnion<\test\fixtures\patch\InnerUnionEnum>, \IThriftShapishSyncStruct {
  use \ThriftUnionSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'innerOption',
      'union' => true,
      'type' => \TType::STRING,
      'is_binary' => true,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'innerOption' => 1,
  ];

  const type TConstructorShape = shape(
    ?'innerOption' => ?string,
  );

  const type TShape = shape(
    ?'innerOption' => ?string,
    ...
  );
  const int STRUCTURAL_ID = 8244649827300221001;
  /**
   * Original thrift field:-
   * 1: binary innerOption
   */
  public ?string $innerOption;
  protected \test\fixtures\patch\InnerUnionEnum $_type = \test\fixtures\patch\InnerUnionEnum::_EMPTY_;

  public function __construct(?string $innerOption = null)[] {
    $this->_type = \test\fixtures\patch\InnerUnionEnum::_EMPTY_;
    if ($innerOption !== null) {
      $this->innerOption = $innerOption;
      $this->_type = \test\fixtures\patch\InnerUnionEnum::innerOption;
    }
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'innerOption'),
    );
  }

  public function getName()[]: string {
    return 'InnerUnion';
  }

  public function getType()[]: \test\fixtures\patch\InnerUnionEnum {
    return $this->_type;
  }

  public function reset()[write_props]: void {
    switch ($this->_type) {
      case \test\fixtures\patch\InnerUnionEnum::innerOption:
        $this->innerOption = null;
        break;
      case \test\fixtures\patch\InnerUnionEnum::_EMPTY_:
        break;
    }
    $this->_type = \test\fixtures\patch\InnerUnionEnum::_EMPTY_;
  }

  public function set_innerOption(string $innerOption)[write_props]: this {
    $this->reset();
    $this->_type = \test\fixtures\patch\InnerUnionEnum::innerOption;
    $this->innerOption = $innerOption;
    return $this;
  }

  public function get_innerOption()[]: ?string {
    return $this->innerOption;
  }

  public function getx_innerOption()[]: string {
    invariant(
      $this->_type === \test\fixtures\patch\InnerUnionEnum::innerOption,
      'get_innerOption called on an instance of InnerUnion whose current type is %s',
      (string)$this->_type,
    );
    return $this->innerOption as nonnull;
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.InnerUnion",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE,
                )
              ),
              "name" => "innerOption",
            )
          ),
        ],
        "is_union" => true,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'innerOption'),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'innerOption' => $this->innerOption,
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $this->_type = \test\fixtures\patch\InnerUnionEnum::_EMPTY_;
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'innerOption') !== null) {
      $this->innerOption = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['innerOption']);
      $this->_type = \test\fixtures\patch\InnerUnionEnum::innerOption;
    }
  }

}

enum MyUnionEnum: int {
  _EMPTY_ = 0;
  option1 = 1;
  option2 = 2;
  option3 = 3;
}

/**
 * Original thrift struct:-
 * MyUnion
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyUnion'))>>
class MyUnion implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftUnion<\test\fixtures\patch\MyUnionEnum>, \IThriftShapishSyncStruct {
  use \ThriftUnionSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'option1',
      'union' => true,
      'type' => \TType::STRING,
    ),
    2 => shape(
      'var' => 'option2',
      'union' => true,
      'type' => \TType::I32,
    ),
    3 => shape(
      'var' => 'option3',
      'union' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\InnerUnion::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'option1' => 1,
    'option2' => 2,
    'option3' => 3,
  ];

  const type TConstructorShape = shape(
    ?'option1' => ?string,
    ?'option2' => ?int,
    ?'option3' => ?\test\fixtures\patch\InnerUnion,
  );

  const type TShape = shape(
    ?'option1' => ?string,
    ?'option2' => ?int,
    ?'option3' => ?\test\fixtures\patch\InnerUnion::TShape,
    ...
  );
  const int STRUCTURAL_ID = 2373941666242479705;
  /**
   * Original thrift field:-
   * 1: string option1
   */
  public ?string $option1;
  /**
   * Original thrift field:-
   * 2: i32 option2
   */
  public ?int $option2;
  /**
   * Original thrift field:-
   * 3: module.InnerUnion option3
   */
  public ?\test\fixtures\patch\InnerUnion $option3;
  protected \test\fixtures\patch\MyUnionEnum $_type = \test\fixtures\patch\MyUnionEnum::_EMPTY_;

  public function __construct(?string $option1 = null, ?int $option2 = null, ?\test\fixtures\patch\InnerUnion $option3 = null)[] {
    $this->_type = \test\fixtures\patch\MyUnionEnum::_EMPTY_;
    if ($option1 !== null) {
      $this->option1 = $option1;
      $this->_type = \test\fixtures\patch\MyUnionEnum::option1;
    }
    if ($option2 !== null) {
      $this->option2 = $option2;
      $this->_type = \test\fixtures\patch\MyUnionEnum::option2;
    }
    if ($option3 !== null) {
      $this->option3 = $option3;
      $this->_type = \test\fixtures\patch\MyUnionEnum::option3;
    }
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'option1'),
      Shapes::idx($shape, 'option2'),
      Shapes::idx($shape, 'option3'),
    );
  }

  public function getName()[]: string {
    return 'MyUnion';
  }

  public function getType()[]: \test\fixtures\patch\MyUnionEnum {
    return $this->_type;
  }

  public function reset()[write_props]: void {
    switch ($this->_type) {
      case \test\fixtures\patch\MyUnionEnum::option1:
        $this->option1 = null;
        break;
      case \test\fixtures\patch\MyUnionEnum::option2:
        $this->option2 = null;
        break;
      case \test\fixtures\patch\MyUnionEnum::option3:
        $this->option3 = null;
        break;
      case \test\fixtures\patch\MyUnionEnum::_EMPTY_:
        break;
    }
    $this->_type = \test\fixtures\patch\MyUnionEnum::_EMPTY_;
  }

  public function set_option1(string $option1)[write_props]: this {
    $this->reset();
    $this->_type = \test\fixtures\patch\MyUnionEnum::option1;
    $this->option1 = $option1;
    return $this;
  }

  public function get_option1()[]: ?string {
    return $this->option1;
  }

  public function getx_option1()[]: string {
    invariant(
      $this->_type === \test\fixtures\patch\MyUnionEnum::option1,
      'get_option1 called on an instance of MyUnion whose current type is %s',
      (string)$this->_type,
    );
    return $this->option1 as nonnull;
  }

  public function set_option2(int $option2)[write_props]: this {
    $this->reset();
    $this->_type = \test\fixtures\patch\MyUnionEnum::option2;
    $this->option2 = $option2;
    return $this;
  }

  public function get_option2()[]: ?int {
    return $this->option2;
  }

  public function getx_option2()[]: int {
    invariant(
      $this->_type === \test\fixtures\patch\MyUnionEnum::option2,
      'get_option2 called on an instance of MyUnion whose current type is %s',
      (string)$this->_type,
    );
    return $this->option2 as nonnull;
  }

  public function set_option3(\test\fixtures\patch\InnerUnion $option3)[write_props]: this {
    $this->reset();
    $this->_type = \test\fixtures\patch\MyUnionEnum::option3;
    $this->option3 = $option3;
    return $this;
  }

  public function get_option3()[]: ?\test\fixtures\patch\InnerUnion {
    return $this->option3;
  }

  public function getx_option3()[]: \test\fixtures\patch\InnerUnion {
    invariant(
      $this->_type === \test\fixtures\patch\MyUnionEnum::option3,
      'get_option3 called on an instance of MyUnion whose current type is %s',
      (string)$this->_type,
    );
    return $this->option3 as nonnull;
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyUnion",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "option1",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "option2",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.InnerUnion",
                    )
                  ),
                )
              ),
              "name" => "option3",
            )
          ),
        ],
        "is_union" => true,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'option1'),
      Shapes::idx($shape, 'option2'),
      Shapes::idx($shape, 'option3') === null ? null : (\test\fixtures\patch\InnerUnion::__fromShape($shape['option3'])),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'option1' => $this->option1,
      'option2' => $this->option2,
      'option3' => $this->option3?->__toShape(),
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $this->_type = \test\fixtures\patch\MyUnionEnum::_EMPTY_;
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'option1') !== null) {
      $this->option1 = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['option1']);
      $this->_type = \test\fixtures\patch\MyUnionEnum::option1;
    }
    if (idx($parsed, 'option2') !== null) {
      $_tmp0 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['option2']);
      if ($_tmp0 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->option2 = (int)$_tmp0;
      }
      $this->_type = \test\fixtures\patch\MyUnionEnum::option2;
    }
    if (idx($parsed, 'option3') !== null) {
      $_tmp1 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\InnerUnion>($parsed['option3']));
      $_tmp2 = \test\fixtures\patch\InnerUnion::withDefaultValues();
      $_tmp2->readFromJson($_tmp1);
      $this->option3 = $_tmp2;
      $this->_type = \test\fixtures\patch\MyUnionEnum::option3;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStruct'))>>
class MyStruct implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'boolVal',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    -2 => shape(
      'var' => 'byteVal',
      'is_terse' => true,
      'type' => \TType::BYTE,
    ),
    -3 => shape(
      'var' => 'i16Val',
      'is_terse' => true,
      'type' => \TType::I16,
    ),
    -4 => shape(
      'var' => 'i32Val',
      'is_terse' => true,
      'type' => \TType::I32,
    ),
    -5 => shape(
      'var' => 'i64Val',
      'is_terse' => true,
      'type' => \TType::I64,
    ),
    -6 => shape(
      'var' => 'floatVal',
      'is_terse' => true,
      'type' => \TType::FLOAT,
    ),
    -7 => shape(
      'var' => 'doubleVal',
      'is_terse' => true,
      'type' => \TType::DOUBLE,
    ),
    -8 => shape(
      'var' => 'stringVal',
      'is_terse' => true,
      'type' => \TType::STRING,
    ),
    -9 => shape(
      'var' => 'binaryVal',
      'is_terse' => true,
      'type' => \TType::STRING,
      'is_binary' => true,
    ),
    -10 => shape(
      'var' => 'enumVal',
      'is_terse' => true,
      'type' => \TType::I32,
      'enum' => \test\fixtures\patch\MyEnum::class,
    ),
    -11 => shape(
      'var' => 'structVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyData::class,
    ),
    -12 => shape(
      'var' => 'unionVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyUnion::class,
    ),
    -13 => shape(
      'var' => 'lateStructVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStruct::class,
    ),
    -14 => shape(
      'var' => 'optBoolVal',
      'type' => \TType::BOOL,
    ),
    -15 => shape(
      'var' => 'optByteVal',
      'type' => \TType::BYTE,
    ),
    -16 => shape(
      'var' => 'optI16Val',
      'type' => \TType::I16,
    ),
    -17 => shape(
      'var' => 'optI32Val',
      'type' => \TType::I32,
    ),
    -18 => shape(
      'var' => 'optI64Val',
      'type' => \TType::I64,
    ),
    -19 => shape(
      'var' => 'optFloatVal',
      'type' => \TType::FLOAT,
    ),
    -20 => shape(
      'var' => 'optDoubleVal',
      'type' => \TType::DOUBLE,
    ),
    -21 => shape(
      'var' => 'optStringVal',
      'type' => \TType::STRING,
    ),
    -22 => shape(
      'var' => 'optBinaryVal',
      'type' => \TType::STRING,
      'is_binary' => true,
    ),
    -23 => shape(
      'var' => 'optEnumVal',
      'type' => \TType::I32,
      'enum' => \test\fixtures\patch\MyEnum::class,
    ),
    -24 => shape(
      'var' => 'optStructVal',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyData::class,
    ),
    -25 => shape(
      'var' => 'optLateStructVal',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStruct::class,
    ),
    -26 => shape(
      'var' => 'optListVal',
      'type' => \TType::LST,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
    -27 => shape(
      'var' => 'optSetVal',
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    -28 => shape(
      'var' => 'optMapVal',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRING,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    -29 => shape(
      'var' => 'listMap',
      'is_terse' => true,
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    -30 => shape(
      'var' => 'mapMap',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::MAP,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    -31 => shape(
      'var' => 'i32WithCustomDefault',
      'is_terse' => true,
      'type' => \TType::I32,
    ),
    -32 => shape(
      'var' => 'structWithCustomDefault',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataWithCustomDefault::class,
    ),
    1 => shape(
      'var' => 'structWithFieldCustomDefault',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyData::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'boolVal' => -1,
    'byteVal' => -2,
    'i16Val' => -3,
    'i32Val' => -4,
    'i64Val' => -5,
    'floatVal' => -6,
    'doubleVal' => -7,
    'stringVal' => -8,
    'binaryVal' => -9,
    'enumVal' => -10,
    'structVal' => -11,
    'unionVal' => -12,
    'lateStructVal' => -13,
    'optBoolVal' => -14,
    'optByteVal' => -15,
    'optI16Val' => -16,
    'optI32Val' => -17,
    'optI64Val' => -18,
    'optFloatVal' => -19,
    'optDoubleVal' => -20,
    'optStringVal' => -21,
    'optBinaryVal' => -22,
    'optEnumVal' => -23,
    'optStructVal' => -24,
    'optLateStructVal' => -25,
    'optListVal' => -26,
    'optSetVal' => -27,
    'optMapVal' => -28,
    'listMap' => -29,
    'mapMap' => -30,
    'i32WithCustomDefault' => -31,
    'structWithCustomDefault' => -32,
    'structWithFieldCustomDefault' => 1,
  ];

  const type TConstructorShape = shape(
    ?'boolVal' => ?bool,
    ?'byteVal' => ?int,
    ?'i16Val' => ?int,
    ?'i32Val' => ?int,
    ?'i64Val' => ?int,
    ?'floatVal' => ?float,
    ?'doubleVal' => ?float,
    ?'stringVal' => ?string,
    ?'binaryVal' => ?string,
    ?'enumVal' => ?\test\fixtures\patch\MyEnum,
    ?'structVal' => ?\test\fixtures\patch\MyData,
    ?'unionVal' => ?\test\fixtures\patch\MyUnion,
    ?'lateStructVal' => ?\test\fixtures\patch\LateDefStruct,
    ?'optBoolVal' => ?bool,
    ?'optByteVal' => ?int,
    ?'optI16Val' => ?int,
    ?'optI32Val' => ?int,
    ?'optI64Val' => ?int,
    ?'optFloatVal' => ?float,
    ?'optDoubleVal' => ?float,
    ?'optStringVal' => ?string,
    ?'optBinaryVal' => ?string,
    ?'optEnumVal' => ?\test\fixtures\patch\MyEnum,
    ?'optStructVal' => ?\test\fixtures\patch\MyData,
    ?'optLateStructVal' => ?\test\fixtures\patch\LateDefStruct,
    ?'optListVal' => ?Vector<int>,
    ?'optSetVal' => ?Set<string>,
    ?'optMapVal' => ?Map<string, string>,
    ?'listMap' => ?Vector<Map<string, int>>,
    ?'mapMap' => ?Map<string, Map<string, int>>,
    ?'i32WithCustomDefault' => ?int,
    ?'structWithCustomDefault' => ?\test\fixtures\patch\MyDataWithCustomDefault,
    ?'structWithFieldCustomDefault' => ?\test\fixtures\patch\MyData,
  );

  const type TShape = shape(
    'boolVal' => bool,
    'byteVal' => int,
    'i16Val' => int,
    'i32Val' => int,
    'i64Val' => int,
    'floatVal' => float,
    'doubleVal' => float,
    'stringVal' => string,
    'binaryVal' => string,
    ?'enumVal' => ?\test\fixtures\patch\MyEnum,
    ?'structVal' => ?\test\fixtures\patch\MyData::TShape,
    ?'unionVal' => ?\test\fixtures\patch\MyUnion::TShape,
    ?'lateStructVal' => ?\test\fixtures\patch\LateDefStruct::TShape,
    ?'optBoolVal' => ?bool,
    ?'optByteVal' => ?int,
    ?'optI16Val' => ?int,
    ?'optI32Val' => ?int,
    ?'optI64Val' => ?int,
    ?'optFloatVal' => ?float,
    ?'optDoubleVal' => ?float,
    ?'optStringVal' => ?string,
    ?'optBinaryVal' => ?string,
    ?'optEnumVal' => ?\test\fixtures\patch\MyEnum,
    ?'optStructVal' => ?\test\fixtures\patch\MyData::TShape,
    ?'optLateStructVal' => ?\test\fixtures\patch\LateDefStruct::TShape,
    ?'optListVal' => ?vec<int>,
    ?'optSetVal' => ?dict<string, bool>,
    ?'optMapVal' => ?dict<string, string>,
    'listMap' => vec<dict<string, int>>,
    'mapMap' => dict<string, dict<string, int>>,
    'i32WithCustomDefault' => int,
    ?'structWithCustomDefault' => ?\test\fixtures\patch\MyDataWithCustomDefault::TShape,
    ?'structWithFieldCustomDefault' => ?\test\fixtures\patch\MyData::TShape,
    ...
  );
  const int STRUCTURAL_ID = 8604220942000869633;
  /**
   * Original thrift field:-
   * -1: bool boolVal
   */
  public bool $boolVal;
  /**
   * Original thrift field:-
   * -2: byte byteVal
   */
  public int $byteVal;
  /**
   * Original thrift field:-
   * -3: i16 i16Val
   */
  public int $i16Val;
  /**
   * Original thrift field:-
   * -4: i32 i32Val
   */
  public int $i32Val;
  /**
   * Original thrift field:-
   * -5: i64 i64Val
   */
  public int $i64Val;
  /**
   * Original thrift field:-
   * -6: float floatVal
   */
  public float $floatVal;
  /**
   * Original thrift field:-
   * -7: double doubleVal
   */
  public float $doubleVal;
  /**
   * Original thrift field:-
   * -8: string stringVal
   */
  public string $stringVal;
  /**
   * Original thrift field:-
   * -9: binary binaryVal
   */
  public string $binaryVal;
  /**
   * Original thrift field:-
   * -10: module.MyEnum enumVal
   */
  public ?\test\fixtures\patch\MyEnum $enumVal;
  /**
   * Original thrift field:-
   * -11: module.MyData structVal
   */
  public ?\test\fixtures\patch\MyData $structVal;
  /**
   * Original thrift field:-
   * -12: module.MyUnion unionVal
   */
  public ?\test\fixtures\patch\MyUnion $unionVal;
  /**
   * Original thrift field:-
   * -13: module.LateDefStruct lateStructVal
   */
  public ?\test\fixtures\patch\LateDefStruct $lateStructVal;
  /**
   * Original thrift field:-
   * -14: bool optBoolVal
   */
  public ?bool $optBoolVal;
  /**
   * Original thrift field:-
   * -15: byte optByteVal
   */
  public ?int $optByteVal;
  /**
   * Original thrift field:-
   * -16: i16 optI16Val
   */
  public ?int $optI16Val;
  /**
   * Original thrift field:-
   * -17: i32 optI32Val
   */
  public ?int $optI32Val;
  /**
   * Original thrift field:-
   * -18: i64 optI64Val
   */
  public ?int $optI64Val;
  /**
   * Original thrift field:-
   * -19: float optFloatVal
   */
  public ?float $optFloatVal;
  /**
   * Original thrift field:-
   * -20: double optDoubleVal
   */
  public ?float $optDoubleVal;
  /**
   * Original thrift field:-
   * -21: string optStringVal
   */
  public ?string $optStringVal;
  /**
   * Original thrift field:-
   * -22: binary optBinaryVal
   */
  public ?string $optBinaryVal;
  /**
   * Original thrift field:-
   * -23: module.MyEnum optEnumVal
   */
  public ?\test\fixtures\patch\MyEnum $optEnumVal;
  /**
   * Original thrift field:-
   * -24: module.MyData optStructVal
   */
  public ?\test\fixtures\patch\MyData $optStructVal;
  /**
   * Original thrift field:-
   * -25: module.LateDefStruct optLateStructVal
   */
  public ?\test\fixtures\patch\LateDefStruct $optLateStructVal;
  /**
   * Original thrift field:-
   * -26: list<i16> optListVal
   */
  public ?Vector<int> $optListVal;
  /**
   * Original thrift field:-
   * -27: set<string> optSetVal
   */
  public ?Set<string> $optSetVal;
  /**
   * Original thrift field:-
   * -28: map<string, string> optMapVal
   */
  public ?Map<string, string> $optMapVal;
  /**
   * Original thrift field:-
   * -29: list<map<string, i32>> listMap
   */
  public Vector<Map<string, int>> $listMap;
  /**
   * Original thrift field:-
   * -30: map<string, map<string, i32>> mapMap
   */
  public Map<string, Map<string, int>> $mapMap;
  /**
   * Original thrift field:-
   * -31: i32 i32WithCustomDefault
   */
  public int $i32WithCustomDefault;
  /**
   * Original thrift field:-
   * -32: module.MyDataWithCustomDefault structWithCustomDefault
   */
  public ?\test\fixtures\patch\MyDataWithCustomDefault $structWithCustomDefault;
  /**
   * Original thrift field:-
   * 1: module.MyData structWithFieldCustomDefault
   */
  public ?\test\fixtures\patch\MyData $structWithFieldCustomDefault;

  public function __construct(?bool $boolVal = null, ?int $byteVal = null, ?int $i16Val = null, ?int $i32Val = null, ?int $i64Val = null, ?float $floatVal = null, ?float $doubleVal = null, ?string $stringVal = null, ?string $binaryVal = null, ?\test\fixtures\patch\MyEnum $enumVal = null, ?\test\fixtures\patch\MyData $structVal = null, ?\test\fixtures\patch\MyUnion $unionVal = null, ?\test\fixtures\patch\LateDefStruct $lateStructVal = null, ?bool $optBoolVal = null, ?int $optByteVal = null, ?int $optI16Val = null, ?int $optI32Val = null, ?int $optI64Val = null, ?float $optFloatVal = null, ?float $optDoubleVal = null, ?string $optStringVal = null, ?string $optBinaryVal = null, ?\test\fixtures\patch\MyEnum $optEnumVal = null, ?\test\fixtures\patch\MyData $optStructVal = null, ?\test\fixtures\patch\LateDefStruct $optLateStructVal = null, ?Vector<int> $optListVal = null, ?Set<string> $optSetVal = null, ?Map<string, string> $optMapVal = null, ?Vector<Map<string, int>> $listMap = null, ?Map<string, Map<string, int>> $mapMap = null, ?int $i32WithCustomDefault = null, ?\test\fixtures\patch\MyDataWithCustomDefault $structWithCustomDefault = null, ?\test\fixtures\patch\MyData $structWithFieldCustomDefault = null)[] {
    $this->boolVal = $boolVal ?? false;
    $this->byteVal = $byteVal ?? 0;
    $this->i16Val = $i16Val ?? 0;
    $this->i32Val = $i32Val ?? 0;
    $this->i64Val = $i64Val ?? 0;
    $this->floatVal = $floatVal ?? 0.0;
    $this->doubleVal = $doubleVal ?? 0.0;
    $this->stringVal = $stringVal ?? '';
    $this->binaryVal = $binaryVal ?? '';
    $this->enumVal = $enumVal;
    $this->structVal = $structVal;
    $this->unionVal = $unionVal;
    $this->lateStructVal = $lateStructVal;
    $this->optBoolVal = $optBoolVal;
    $this->optByteVal = $optByteVal;
    $this->optI16Val = $optI16Val;
    $this->optI32Val = $optI32Val;
    $this->optI64Val = $optI64Val;
    $this->optFloatVal = $optFloatVal;
    $this->optDoubleVal = $optDoubleVal;
    $this->optStringVal = $optStringVal;
    $this->optBinaryVal = $optBinaryVal;
    $this->optEnumVal = $optEnumVal;
    $this->optStructVal = $optStructVal;
    $this->optLateStructVal = $optLateStructVal;
    $this->optListVal = $optListVal;
    $this->optSetVal = $optSetVal;
    $this->optMapVal = $optMapVal;
    $this->listMap = $listMap ?? Vector {};
    $this->mapMap = $mapMap ?? Map {};
    $this->i32WithCustomDefault = $i32WithCustomDefault ?? 1;
    $this->structWithCustomDefault = $structWithCustomDefault;
    $this->structWithFieldCustomDefault = $structWithFieldCustomDefault;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'boolVal'),
      Shapes::idx($shape, 'byteVal'),
      Shapes::idx($shape, 'i16Val'),
      Shapes::idx($shape, 'i32Val'),
      Shapes::idx($shape, 'i64Val'),
      Shapes::idx($shape, 'floatVal'),
      Shapes::idx($shape, 'doubleVal'),
      Shapes::idx($shape, 'stringVal'),
      Shapes::idx($shape, 'binaryVal'),
      Shapes::idx($shape, 'enumVal'),
      Shapes::idx($shape, 'structVal'),
      Shapes::idx($shape, 'unionVal'),
      Shapes::idx($shape, 'lateStructVal'),
      Shapes::idx($shape, 'optBoolVal'),
      Shapes::idx($shape, 'optByteVal'),
      Shapes::idx($shape, 'optI16Val'),
      Shapes::idx($shape, 'optI32Val'),
      Shapes::idx($shape, 'optI64Val'),
      Shapes::idx($shape, 'optFloatVal'),
      Shapes::idx($shape, 'optDoubleVal'),
      Shapes::idx($shape, 'optStringVal'),
      Shapes::idx($shape, 'optBinaryVal'),
      Shapes::idx($shape, 'optEnumVal'),
      Shapes::idx($shape, 'optStructVal'),
      Shapes::idx($shape, 'optLateStructVal'),
      Shapes::idx($shape, 'optListVal'),
      Shapes::idx($shape, 'optSetVal'),
      Shapes::idx($shape, 'optMapVal'),
      Shapes::idx($shape, 'listMap'),
      Shapes::idx($shape, 'mapMap'),
      Shapes::idx($shape, 'i32WithCustomDefault'),
      Shapes::idx($shape, 'structWithCustomDefault'),
      Shapes::idx($shape, 'structWithFieldCustomDefault'),
    );
  }

  public function getName()[]: string {
    return 'MyStruct';
  }

  public function clearTerseFields()[write_props]: void {
    $this->boolVal = false;
    $this->byteVal = 0;
    $this->i16Val = 0;
    $this->i32Val = 0;
    $this->i64Val = 0;
    $this->floatVal = 0.0;
    $this->doubleVal = 0.0;
    $this->stringVal = '';
    $this->binaryVal = '';
    $this->enumVal = null;
    $this->structVal = null;
    $this->unionVal = null;
    $this->lateStructVal = null;
    $this->listMap = Vector {};
    $this->mapMap = Map {};
    $this->i32WithCustomDefault = 0;
    $this->structWithCustomDefault = null;
    $this->structWithFieldCustomDefault = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "boolVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BYTE_TYPE,
                )
              ),
              "name" => "byteVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                )
              ),
              "name" => "i16Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -4,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                )
              ),
              "name" => "i64Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_FLOAT_TYPE,
                )
              ),
              "name" => "floatVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE,
                )
              ),
              "name" => "doubleVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -8,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "stringVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE,
                )
              ),
              "name" => "binaryVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -10,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum",
                    )
                  ),
                )
              ),
              "name" => "enumVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -11,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyData",
                    )
                  ),
                )
              ),
              "name" => "structVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -12,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyUnion",
                    )
                  ),
                )
              ),
              "name" => "unionVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -13,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.LateDefStruct",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.LateDefStruct",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "lateStructVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -14,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "optBoolVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -15,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BYTE_TYPE,
                )
              ),
              "name" => "optByteVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -16,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                )
              ),
              "name" => "optI16Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -17,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "optI32Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -18,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                )
              ),
              "name" => "optI64Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -19,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_FLOAT_TYPE,
                )
              ),
              "name" => "optFloatVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -20,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE,
                )
              ),
              "name" => "optDoubleVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -21,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "optStringVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -22,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE,
                )
              ),
              "name" => "optBinaryVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -23,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum",
                    )
                  ),
                )
              ),
              "name" => "optEnumVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -24,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyData",
                    )
                  ),
                )
              ),
              "name" => "optStructVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -25,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.LateDefStruct",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.LateDefStruct",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optLateStructVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -26,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optListVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -27,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optSetVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -28,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optMapVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -29,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "listMap",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -30,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "mapMap",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -31,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32WithCustomDefault",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -32,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataWithCustomDefault",
                    )
                  ),
                )
              ),
              "name" => "structWithCustomDefault",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyData",
                    )
                  ),
                )
              ),
              "name" => "structWithFieldCustomDefault",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\Testing' => \facebook\thrift\annotation\Testing::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      $shape['boolVal'],
      $shape['byteVal'],
      $shape['i16Val'],
      $shape['i32Val'],
      $shape['i64Val'],
      $shape['floatVal'],
      $shape['doubleVal'],
      $shape['stringVal'],
      $shape['binaryVal'],
      Shapes::idx($shape, 'enumVal'),
      Shapes::idx($shape, 'structVal') === null ? null : (\test\fixtures\patch\MyData::__fromShape($shape['structVal'])),
      Shapes::idx($shape, 'unionVal') === null ? null : (\test\fixtures\patch\MyUnion::__fromShape($shape['unionVal'])),
      Shapes::idx($shape, 'lateStructVal') === null ? null : (\test\fixtures\patch\LateDefStruct::__fromShape($shape['lateStructVal'])),
      Shapes::idx($shape, 'optBoolVal'),
      Shapes::idx($shape, 'optByteVal'),
      Shapes::idx($shape, 'optI16Val'),
      Shapes::idx($shape, 'optI32Val'),
      Shapes::idx($shape, 'optI64Val'),
      Shapes::idx($shape, 'optFloatVal'),
      Shapes::idx($shape, 'optDoubleVal'),
      Shapes::idx($shape, 'optStringVal'),
      Shapes::idx($shape, 'optBinaryVal'),
      Shapes::idx($shape, 'optEnumVal'),
      Shapes::idx($shape, 'optStructVal') === null ? null : (\test\fixtures\patch\MyData::__fromShape($shape['optStructVal'])),
      Shapes::idx($shape, 'optLateStructVal') === null ? null : (\test\fixtures\patch\LateDefStruct::__fromShape($shape['optLateStructVal'])),
      Shapes::idx($shape, 'optListVal') === null ? null : ($shape['optListVal'] |> new Vector($$)),
      Shapes::idx($shape, 'optSetVal') === null ? null : (new Set(Keyset\keys($shape['optSetVal']))),
      Shapes::idx($shape, 'optMapVal') === null ? null : ($shape['optMapVal'] |> new Map($$)),
      $shape['listMap']
        |> Vec\map(
          $$,
          $_val0 ==> $_val0 |> new Map($$),
        ) |> new Vector($$),
      $shape['mapMap']
        |> Dict\map(
          $$,
          $_val1 ==> $_val1 |> new Map($$),
        ) |> new Map($$),
      $shape['i32WithCustomDefault'],
      Shapes::idx($shape, 'structWithCustomDefault') === null ? null : (\test\fixtures\patch\MyDataWithCustomDefault::__fromShape($shape['structWithCustomDefault'])),
      Shapes::idx($shape, 'structWithFieldCustomDefault') === null ? null : (\test\fixtures\patch\MyData::__fromShape($shape['structWithFieldCustomDefault'])),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'boolVal' => $this->boolVal,
      'byteVal' => $this->byteVal,
      'i16Val' => $this->i16Val,
      'i32Val' => $this->i32Val,
      'i64Val' => $this->i64Val,
      'floatVal' => $this->floatVal,
      'doubleVal' => $this->doubleVal,
      'stringVal' => $this->stringVal,
      'binaryVal' => $this->binaryVal,
      'enumVal' => $this->enumVal,
      'structVal' => $this->structVal?->__toShape(),
      'unionVal' => $this->unionVal?->__toShape(),
      'lateStructVal' => $this->lateStructVal?->__toShape(),
      'optBoolVal' => $this->optBoolVal,
      'optByteVal' => $this->optByteVal,
      'optI16Val' => $this->optI16Val,
      'optI32Val' => $this->optI32Val,
      'optI64Val' => $this->optI64Val,
      'optFloatVal' => $this->optFloatVal,
      'optDoubleVal' => $this->optDoubleVal,
      'optStringVal' => $this->optStringVal,
      'optBinaryVal' => $this->optBinaryVal,
      'optEnumVal' => $this->optEnumVal,
      'optStructVal' => $this->optStructVal?->__toShape(),
      'optLateStructVal' => $this->optLateStructVal?->__toShape(),
      'optListVal' => $this->optListVal
        |> $$ === null ? null : vec($$),
      'optSetVal' => $this->optSetVal
        |> $$ === null ? null : ThriftUtil::toDArray(Dict\fill_keys($$->toValuesArray(), true), static::class),
      'optMapVal' => $this->optMapVal
        |> $$ === null ? null : dict($$),
      'listMap' => $this->listMap->map(
        ($_val0) ==> dict($_val0),
      )
        |> vec($$),
      'mapMap' => $this->mapMap->map(
        ($_val0) ==> dict($_val0),
      )
        |> dict($$),
      'i32WithCustomDefault' => $this->i32WithCustomDefault,
      'structWithCustomDefault' => $this->structWithCustomDefault?->__toShape(),
      'structWithFieldCustomDefault' => $this->structWithFieldCustomDefault?->__toShape(),
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'boolVal') !== null) {
      $this->boolVal = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['boolVal']);
    }
    if (idx($parsed, 'byteVal') !== null) {
      $_tmp0 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['byteVal']);
      if ($_tmp0 > 0x7f) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->byteVal = (int)$_tmp0;
      }
    }
    if (idx($parsed, 'i16Val') !== null) {
      $_tmp1 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i16Val']);
      if ($_tmp1 > 0x7fff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->i16Val = (int)$_tmp1;
      }
    }
    if (idx($parsed, 'i32Val') !== null) {
      $_tmp2 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i32Val']);
      if ($_tmp2 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->i32Val = (int)$_tmp2;
      }
    }
    if (idx($parsed, 'i64Val') !== null) {
      $this->i64Val = HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i64Val']);
    }
    if (idx($parsed, 'floatVal') !== null) {
      $this->floatVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['floatVal']);
    }
    if (idx($parsed, 'doubleVal') !== null) {
      $this->doubleVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['doubleVal']);
    }
    if (idx($parsed, 'stringVal') !== null) {
      $this->stringVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['stringVal']);
    }
    if (idx($parsed, 'binaryVal') !== null) {
      $this->binaryVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['binaryVal']);
    }
    if (idx($parsed, 'enumVal') !== null) {
      $this->enumVal = \test\fixtures\patch\MyEnum::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyEnum>($parsed['enumVal']));
    }
    if (idx($parsed, 'structVal') !== null) {
      $_tmp3 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyData>($parsed['structVal']));
      $_tmp4 = \test\fixtures\patch\MyData::withDefaultValues();
      $_tmp4->readFromJson($_tmp3);
      $this->structVal = $_tmp4;
    }
    if (idx($parsed, 'unionVal') !== null) {
      $_tmp5 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyUnion>($parsed['unionVal']));
      $_tmp6 = \test\fixtures\patch\MyUnion::withDefaultValues();
      $_tmp6->readFromJson($_tmp5);
      $this->unionVal = $_tmp6;
    }
    if (idx($parsed, 'lateStructVal') !== null) {
      $_tmp7 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStruct>($parsed['lateStructVal']));
      $_tmp8 = \test\fixtures\patch\LateDefStruct::withDefaultValues();
      $_tmp8->readFromJson($_tmp7);
      $this->lateStructVal = $_tmp8;
    }
    if (idx($parsed, 'optBoolVal') !== null) {
      $this->optBoolVal = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['optBoolVal']);
    }
    if (idx($parsed, 'optByteVal') !== null) {
      $_tmp9 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optByteVal']);
      if ($_tmp9 > 0x7f) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->optByteVal = (int)$_tmp9;
      }
    }
    if (idx($parsed, 'optI16Val') !== null) {
      $_tmp10 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optI16Val']);
      if ($_tmp10 > 0x7fff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->optI16Val = (int)$_tmp10;
      }
    }
    if (idx($parsed, 'optI32Val') !== null) {
      $_tmp11 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optI32Val']);
      if ($_tmp11 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->optI32Val = (int)$_tmp11;
      }
    }
    if (idx($parsed, 'optI64Val') !== null) {
      $this->optI64Val = HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optI64Val']);
    }
    if (idx($parsed, 'optFloatVal') !== null) {
      $this->optFloatVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['optFloatVal']);
    }
    if (idx($parsed, 'optDoubleVal') !== null) {
      $this->optDoubleVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['optDoubleVal']);
    }
    if (idx($parsed, 'optStringVal') !== null) {
      $this->optStringVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['optStringVal']);
    }
    if (idx($parsed, 'optBinaryVal') !== null) {
      $this->optBinaryVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['optBinaryVal']);
    }
    if (idx($parsed, 'optEnumVal') !== null) {
      $this->optEnumVal = \test\fixtures\patch\MyEnum::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyEnum>($parsed['optEnumVal']));
    }
    if (idx($parsed, 'optStructVal') !== null) {
      $_tmp12 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyData>($parsed['optStructVal']));
      $_tmp13 = \test\fixtures\patch\MyData::withDefaultValues();
      $_tmp13->readFromJson($_tmp12);
      $this->optStructVal = $_tmp13;
    }
    if (idx($parsed, 'optLateStructVal') !== null) {
      $_tmp14 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStruct>($parsed['optLateStructVal']));
      $_tmp15 = \test\fixtures\patch\LateDefStruct::withDefaultValues();
      $_tmp15->readFromJson($_tmp14);
      $this->optLateStructVal = $_tmp15;
    }
    if (idx($parsed, 'optListVal') !== null) {
      $_json19 = HH\FIXME\UNSAFE_CAST<mixed, Vector<int>>($parsed['optListVal']);
      $_container20 = Vector {};
      foreach($_json19 as $_key17 => $_value18) {
        $_elem21 = 0;
        $_tmp22 = (int)$_value18;
        if ($_tmp22 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem21 = (int)$_tmp22;
        }
        $_container20 []= $_elem21;
      }
      $this->optListVal = $_container20;
    }
    if (idx($parsed, 'optSetVal') !== null) {
      $_json26 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['optSetVal']);
      $_container27 = Set {};
      foreach($_json26 as $_key24 => $_value25) {
        $_elem28 = '';
        $_elem28 = $_value25;
        $_container27->add($_elem28);
      }
      $this->optSetVal = $_container27;
    }
    if (idx($parsed, 'optMapVal') !== null) {
      $_json32 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, string>>($parsed['optMapVal']);
      $_container33 = Map {};
      foreach($_json32 as $_key30 => $_value31) {
        $_value34 = '';
        $_value34 = $_value31;
        $_container33[$_key30] = $_value34;
      }
      $this->optMapVal = $_container33;
    }
    if (idx($parsed, 'listMap') !== null) {
      $_json38 = HH\FIXME\UNSAFE_CAST<mixed, Vector<Map<string, int>>>($parsed['listMap']);
      $_container39 = Vector {};
      foreach($_json38 as $_key36 => $_value37) {
        $_elem40 = Map {};
        $_json44 = $_value37;
        $_container45 = Map {};
        foreach($_json44 as $_key42 => $_value43) {
          $_value46 = 0;
          $_tmp47 = (int)$_value43;
          if ($_tmp47 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value46 = (int)$_tmp47;
          }
          $_container45[$_key42] = $_value46;
        }
        $_elem40 = $_container45;
        $_container39 []= $_elem40;
      }
      $this->listMap = $_container39;
    }
    if (idx($parsed, 'mapMap') !== null) {
      $_json51 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, Map<string, int>>>($parsed['mapMap']);
      $_container52 = Map {};
      foreach($_json51 as $_key49 => $_value50) {
        $_value53 = Map {};
        $_json57 = $_value50;
        $_container58 = Map {};
        foreach($_json57 as $_key55 => $_value56) {
          $_value59 = 0;
          $_tmp60 = (int)$_value56;
          if ($_tmp60 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value59 = (int)$_tmp60;
          }
          $_container58[$_key55] = $_value59;
        }
        $_value53 = $_container58;
        $_container52[$_key49] = $_value53;
      }
      $this->mapMap = $_container52;
    }
    if (idx($parsed, 'i32WithCustomDefault') !== null) {
      $_tmp61 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i32WithCustomDefault']);
      if ($_tmp61 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->i32WithCustomDefault = (int)$_tmp61;
      }
    }
    if (idx($parsed, 'structWithCustomDefault') !== null) {
      $_tmp62 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataWithCustomDefault>($parsed['structWithCustomDefault']));
      $_tmp63 = \test\fixtures\patch\MyDataWithCustomDefault::withDefaultValues();
      $_tmp63->readFromJson($_tmp62);
      $this->structWithCustomDefault = $_tmp63;
    }
    if (idx($parsed, 'structWithFieldCustomDefault') !== null) {
      $_tmp64 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyData>($parsed['structWithFieldCustomDefault']));
      $_tmp65 = \test\fixtures\patch\MyData::withDefaultValues();
      $_tmp65->readFromJson($_tmp64);
      $this->structWithFieldCustomDefault = $_tmp65;
    }
  }

}

/**
 * Original thrift struct:-
 * LateDefStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/LateDefStruct'))>>
class LateDefStruct implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

  public function getName()[]: string {
    return 'LateDefStruct';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.LateDefStruct",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * Original thrift struct:-
 * Recursive
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/Recursive'))>>
class Recursive implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'nodes',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \test\fixtures\patch\Recursive::class,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'nodes' => -1,
  ];

  const type TConstructorShape = shape(
    ?'nodes' => ?Map<string, \test\fixtures\patch\Recursive>,
  );

  const type TShape = shape(
    'nodes' => dict<string, \test\fixtures\patch\Recursive::TShape>,
    ...
  );
  const int STRUCTURAL_ID = 6832467362236085104;
  /**
   * Original thrift field:-
   * -1: map<string, module.Recursive> nodes
   */
  public Map<string, \test\fixtures\patch\Recursive> $nodes;

  public function __construct(?Map<string, \test\fixtures\patch\Recursive> $nodes = null)[] {
    $this->nodes = $nodes ?? Map {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'nodes'),
    );
  }

  public function getName()[]: string {
    return 'Recursive';
  }

  public function clearTerseFields()[write_props]: void {
    $this->nodes = Map {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.Recursive",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "module.Recursive",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                                    shape(
                                      "name" => "module.Recursive",
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "nodes",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
        'nodes' => shape(
          'field' => dict[
            '\facebook\thrift\op\AssignOnlyPatch' => \facebook\thrift\op\AssignOnlyPatch::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[],
        ),
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      $shape['nodes']
        |> Dict\map(
          $$,
          $_val0 ==> $_val0
            |> \test\fixtures\patch\Recursive::__fromShape($$),
        ) |> new Map($$),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'nodes' => $this->nodes->map(
        ($_val0) ==> $_val0->__toShape(),
      )
        |> dict($$),
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'nodes') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \test\fixtures\patch\Recursive>>($parsed['nodes']);
      $_container4 = Map {};
      foreach($_json3 as $_key1 => $_value2) {
        $_value5 = \test\fixtures\patch\Recursive::withDefaultValues();
        $_tmp6 = \json_encode($_value2);
        $_tmp7 = \test\fixtures\patch\Recursive::withDefaultValues();
        $_tmp7->readFromJson($_tmp6);
        $_value5 = $_tmp7;
        $_container4[$_key1] = $_value5;
      }
      $this->nodes = $_container4;
    }
  }

}

/**
 * Original thrift struct:-
 * Bar
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/Bar'))>>
class Bar implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'loop',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\Loop::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'loop' => -1,
  ];

  const type TConstructorShape = shape(
    ?'loop' => ?\test\fixtures\patch\Loop,
  );

  const type TShape = shape(
    ?'loop' => ?\test\fixtures\patch\Loop::TShape,
    ...
  );
  const int STRUCTURAL_ID = 418974100266768802;
  /**
   * Original thrift field:-
   * -1: module.Loop loop
   */
  public ?\test\fixtures\patch\Loop $loop;

  public function __construct(?\test\fixtures\patch\Loop $loop = null)[] {
    $this->loop = $loop;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'loop'),
    );
  }

  public function getName()[]: string {
    return 'Bar';
  }

  public function clearTerseFields()[write_props]: void {
    $this->loop = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.Bar",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.Loop",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.Loop",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "loop",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
        'loop' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\op\AssignOnlyPatch' => \facebook\thrift\op\AssignOnlyPatch::fromShape(
              shape(
              )
            ),
          ],
        ),
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'loop') === null ? null : (\test\fixtures\patch\Loop::__fromShape($shape['loop'])),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'loop' => $this->loop?->__toShape(),
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'loop') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\Loop>($parsed['loop']));
      $_tmp1 = \test\fixtures\patch\Loop::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->loop = $_tmp1;
    }
  }

}

/**
 * Original thrift struct:-
 * Loop
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/Loop'))>>
class Loop implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'bar',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\Bar::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'bar' => -1,
  ];

  const type TConstructorShape = shape(
    ?'bar' => ?\test\fixtures\patch\Bar,
  );

  const type TShape = shape(
    ?'bar' => ?\test\fixtures\patch\Bar::TShape,
    ...
  );
  const int STRUCTURAL_ID = 3942468431999341434;
  /**
   * Original thrift field:-
   * -1: module.Bar bar
   */
  public ?\test\fixtures\patch\Bar $bar;

  public function __construct(?\test\fixtures\patch\Bar $bar = null)[] {
    $this->bar = $bar;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'bar'),
    );
  }

  public function getName()[]: string {
    return 'Loop';
  }

  public function clearTerseFields()[write_props]: void {
    $this->bar = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.Loop",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.Bar",
                    )
                  ),
                )
              ),
              "name" => "bar",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\op\AssignOnlyPatch' => \facebook\thrift\op\AssignOnlyPatch::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
        'bar' => shape(
          'field' => dict[
            '\facebook\thrift\op\AssignOnlyPatch' => \facebook\thrift\op\AssignOnlyPatch::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[],
        ),
      ],
    );
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'bar') === null ? null : (\test\fixtures\patch\Bar::__fromShape($shape['bar'])),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'bar' => $this->bar?->__toShape(),
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'bar') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\Bar>($parsed['bar']));
      $_tmp1 = \test\fixtures\patch\Bar::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->bar = $_tmp1;
    }
  }

}

/**
 * Original thrift struct:-
 * MyDataPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyDataPatch'))>>
class MyDataPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyData::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataFieldPatch::class,
    ),
    5 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataEnsureStruct::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataFieldPatch::class,
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 5,
    'patch' => 6,
    'remove' => 7,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\MyData,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\MyDataFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\MyDataEnsureStruct,
    ?'patch' => ?\test\fixtures\patch\MyDataFieldPatch,
    ?'remove' => ?Set<int>,
  );

  const int STRUCTURAL_ID = 3179324577763743942;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.MyData assign
   */
  public ?\test\fixtures\patch\MyData $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.MyDataFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\MyDataFieldPatch $patchPrior;
  /**
   * Initialize fields, using the given defaults. Applies third.
   *
   * Original thrift field:-
   * 5: module.MyDataEnsureStruct ensure
   */
  public ?\test\fixtures\patch\MyDataEnsureStruct $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.MyDataFieldPatch patch
   */
  public ?\test\fixtures\patch\MyDataFieldPatch $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<patch.FieldId> remove
   */
  public Set<int> $remove;

  public function __construct(?\test\fixtures\patch\MyData $assign = null, ?bool $clear = null, ?\test\fixtures\patch\MyDataFieldPatch $patchPrior = null, ?\test\fixtures\patch\MyDataEnsureStruct $ensure = null, ?\test\fixtures\patch\MyDataFieldPatch $patch = null, ?Set<int> $remove = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
    $this->remove = $remove ?? Set {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
    );
  }

  public function getName()[]: string {
    return 'MyDataPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
    $this->remove = Set {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyDataPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyData",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataEnsureStruct",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "patch.FieldId",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                                    shape(
                                      "name" => "id.FieldId",
                                      "underlyingType" => \tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::MyDataPatchStruct>",
            "underlyingName" => "MyDataPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyDataFieldPatchStruct>",
                "underlyingName" => "MyDataFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
              shape(
              )
            ),
          ],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyDataFieldPatchStruct>",
                "underlyingName" => "MyDataFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyData>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\MyData::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\MyDataFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataEnsureStruct>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\MyDataEnsureStruct::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\MyDataFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json11 = HH\FIXME\UNSAFE_CAST<mixed, Set<int>>($parsed['remove']);
      $_container12 = Set {};
      foreach($_json11 as $_key9 => $_value10) {
        $_elem13 = 0;
        $_tmp14 = (int)$_value10;
        if ($_tmp14 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem13 = (int)$_tmp14;
        }
        $_container12->add($_elem13);
      }
      $this->remove = $_container12;
    }
  }

}

/**
 * Original thrift struct:-
 * MyDataFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyDataFieldPatch'))>>
class MyDataFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'data1',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\StringPatch::class,
    ),
    2 => shape(
      'var' => 'data2',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I32Patch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'data1' => 1,
    'data2' => 2,
  ];

  const type TConstructorShape = shape(
    ?'data1' => ?\facebook\thrift\op\StringPatch,
    ?'data2' => ?\facebook\thrift\op\I32Patch,
  );

  const int STRUCTURAL_ID = 6838201112512803660;
  /**
   * Original thrift field:-
   * 1: patch.StringPatch data1
   */
  public ?\facebook\thrift\op\StringPatch $data1;
  /**
   * Original thrift field:-
   * 2: patch.I32Patch data2
   */
  public ?\facebook\thrift\op\I32Patch $data2;

  public function __construct(?\facebook\thrift\op\StringPatch $data1 = null, ?\facebook\thrift\op\I32Patch $data2 = null)[] {
    $this->data1 = $data1;
    $this->data2 = $data2;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'data1'),
      Shapes::idx($shape, 'data2'),
    );
  }

  public function getName()[]: string {
    return 'MyDataFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->data1 = null;
    $this->data2 = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyDataFieldPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.StringPatch",
                    )
                  ),
                )
              ),
              "name" => "data1",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I32Patch",
                    )
                  ),
                )
              ),
              "name" => "data2",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyDataFieldPatchStruct>",
            "underlyingName" => "MyDataFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'data1' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StringPatchAdapter<::apache::thrift::op::StringPatchStruct>",
                "underlyingName" => "StringPatchStruct",
              )
            ),
          ],
        ),
        'data2' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I32PatchStruct>",
                "underlyingName" => "I32PatchStruct",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'data1') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\StringPatch>($parsed['data1']));
      $_tmp1 = \facebook\thrift\op\StringPatch::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->data1 = $_tmp1;
    }
    if (idx($parsed, 'data2') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I32Patch>($parsed['data2']));
      $_tmp3 = \facebook\thrift\op\I32Patch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->data2 = $_tmp3;
    }
  }

}

/**
 * Original thrift struct:-
 * MyDataEnsureStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyDataEnsureStruct'))>>
class MyDataEnsureStruct implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'data1',
      'type' => \TType::STRING,
    ),
    2 => shape(
      'var' => 'data2',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'data1' => 1,
    'data2' => 2,
  ];

  const type TConstructorShape = shape(
    ?'data1' => ?string,
    ?'data2' => ?int,
  );

  const int STRUCTURAL_ID = 6756681704373274917;
  /**
   * Original thrift field:-
   * 1: string data1
   */
  public ?string $data1;
  /**
   * Original thrift field:-
   * 2: i32 data2
   */
  public ?int $data2;

  public function __construct(?string $data1 = null, ?int $data2 = null)[] {
    $this->data1 = $data1;
    $this->data2 = $data2;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'data1'),
      Shapes::idx($shape, 'data2'),
    );
  }

  public function getName()[]: string {
    return 'MyDataEnsureStruct';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyDataEnsureStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "data1",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "data2",
              "is_optional" => true,
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'data1') !== null) {
      $this->data1 = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['data1']);
    }
    if (idx($parsed, 'data2') !== null) {
      $_tmp0 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['data2']);
      if ($_tmp0 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->data2 = (int)$_tmp0;
      }
    }
  }

}

/**
 * Original thrift struct:-
 * MyDataWithCustomDefaultPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyDataWithCustomDefaultPatch'))>>
class MyDataWithCustomDefaultPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataWithCustomDefault::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataWithCustomDefaultFieldPatch::class,
    ),
    5 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataWithCustomDefaultEnsureStruct::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataWithCustomDefaultFieldPatch::class,
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 5,
    'patch' => 6,
    'remove' => 7,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\MyDataWithCustomDefault,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\MyDataWithCustomDefaultFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\MyDataWithCustomDefaultEnsureStruct,
    ?'patch' => ?\test\fixtures\patch\MyDataWithCustomDefaultFieldPatch,
    ?'remove' => ?Set<int>,
  );

  const int STRUCTURAL_ID = 1453378509450537954;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.MyDataWithCustomDefault assign
   */
  public ?\test\fixtures\patch\MyDataWithCustomDefault $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.MyDataWithCustomDefaultFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\MyDataWithCustomDefaultFieldPatch $patchPrior;
  /**
   * Initialize fields, using the given defaults. Applies third.
   *
   * Original thrift field:-
   * 5: module.MyDataWithCustomDefaultEnsureStruct ensure
   */
  public ?\test\fixtures\patch\MyDataWithCustomDefaultEnsureStruct $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.MyDataWithCustomDefaultFieldPatch patch
   */
  public ?\test\fixtures\patch\MyDataWithCustomDefaultFieldPatch $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<patch.FieldId> remove
   */
  public Set<int> $remove;

  public function __construct(?\test\fixtures\patch\MyDataWithCustomDefault $assign = null, ?bool $clear = null, ?\test\fixtures\patch\MyDataWithCustomDefaultFieldPatch $patchPrior = null, ?\test\fixtures\patch\MyDataWithCustomDefaultEnsureStruct $ensure = null, ?\test\fixtures\patch\MyDataWithCustomDefaultFieldPatch $patch = null, ?Set<int> $remove = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
    $this->remove = $remove ?? Set {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
    );
  }

  public function getName()[]: string {
    return 'MyDataWithCustomDefaultPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
    $this->remove = Set {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyDataWithCustomDefaultPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataWithCustomDefault",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataWithCustomDefaultFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataWithCustomDefaultEnsureStruct",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataWithCustomDefaultFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "patch.FieldId",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                                    shape(
                                      "name" => "id.FieldId",
                                      "underlyingType" => \tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::MyDataWithCustomDefaultPatchStruct>",
            "underlyingName" => "MyDataWithCustomDefaultPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyDataWithCustomDefaultFieldPatchStruct>",
                "underlyingName" => "MyDataWithCustomDefaultFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
              shape(
              )
            ),
          ],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyDataWithCustomDefaultFieldPatchStruct>",
                "underlyingName" => "MyDataWithCustomDefaultFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataWithCustomDefault>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\MyDataWithCustomDefault::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataWithCustomDefaultFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\MyDataWithCustomDefaultFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataWithCustomDefaultEnsureStruct>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\MyDataWithCustomDefaultEnsureStruct::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataWithCustomDefaultFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\MyDataWithCustomDefaultFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json11 = HH\FIXME\UNSAFE_CAST<mixed, Set<int>>($parsed['remove']);
      $_container12 = Set {};
      foreach($_json11 as $_key9 => $_value10) {
        $_elem13 = 0;
        $_tmp14 = (int)$_value10;
        if ($_tmp14 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem13 = (int)$_tmp14;
        }
        $_container12->add($_elem13);
      }
      $this->remove = $_container12;
    }
  }

}

/**
 * Original thrift struct:-
 * MyDataWithCustomDefaultFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyDataWithCustomDefaultFieldPatch'))>>
class MyDataWithCustomDefaultFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'data1',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\StringPatch::class,
    ),
    2 => shape(
      'var' => 'data2',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I32Patch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'data1' => 1,
    'data2' => 2,
  ];

  const type TConstructorShape = shape(
    ?'data1' => ?\facebook\thrift\op\StringPatch,
    ?'data2' => ?\facebook\thrift\op\I32Patch,
  );

  const int STRUCTURAL_ID = 6838201112512803660;
  /**
   * Original thrift field:-
   * 1: patch.StringPatch data1
   */
  public ?\facebook\thrift\op\StringPatch $data1;
  /**
   * Original thrift field:-
   * 2: patch.I32Patch data2
   */
  public ?\facebook\thrift\op\I32Patch $data2;

  public function __construct(?\facebook\thrift\op\StringPatch $data1 = null, ?\facebook\thrift\op\I32Patch $data2 = null)[] {
    $this->data1 = $data1;
    $this->data2 = $data2;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'data1'),
      Shapes::idx($shape, 'data2'),
    );
  }

  public function getName()[]: string {
    return 'MyDataWithCustomDefaultFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->data1 = null;
    $this->data2 = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyDataWithCustomDefaultFieldPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.StringPatch",
                    )
                  ),
                )
              ),
              "name" => "data1",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I32Patch",
                    )
                  ),
                )
              ),
              "name" => "data2",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyDataWithCustomDefaultFieldPatchStruct>",
            "underlyingName" => "MyDataWithCustomDefaultFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'data1' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StringPatchAdapter<::apache::thrift::op::StringPatchStruct>",
                "underlyingName" => "StringPatchStruct",
              )
            ),
          ],
        ),
        'data2' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I32PatchStruct>",
                "underlyingName" => "I32PatchStruct",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'data1') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\StringPatch>($parsed['data1']));
      $_tmp1 = \facebook\thrift\op\StringPatch::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->data1 = $_tmp1;
    }
    if (idx($parsed, 'data2') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I32Patch>($parsed['data2']));
      $_tmp3 = \facebook\thrift\op\I32Patch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->data2 = $_tmp3;
    }
  }

}

/**
 * Original thrift struct:-
 * MyDataWithCustomDefaultEnsureStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyDataWithCustomDefaultEnsureStruct'))>>
class MyDataWithCustomDefaultEnsureStruct implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'data1',
      'type' => \TType::STRING,
    ),
    2 => shape(
      'var' => 'data2',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'data1' => 1,
    'data2' => 2,
  ];

  const type TConstructorShape = shape(
    ?'data1' => ?string,
    ?'data2' => ?int,
  );

  const int STRUCTURAL_ID = 6756681704373274917;
  /**
   * Original thrift field:-
   * 1: string data1
   */
  public ?string $data1;
  /**
   * Original thrift field:-
   * 2: i32 data2
   */
  public ?int $data2;

  public function __construct(?string $data1 = null, ?int $data2 = null)[] {
    $this->data1 = $data1;
    $this->data2 = $data2;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'data1'),
      Shapes::idx($shape, 'data2'),
    );
  }

  public function getName()[]: string {
    return 'MyDataWithCustomDefaultEnsureStruct';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyDataWithCustomDefaultEnsureStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "data1",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "data2",
              "is_optional" => true,
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'data1') !== null) {
      $this->data1 = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['data1']);
    }
    if (idx($parsed, 'data2') !== null) {
      $_tmp0 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['data2']);
      if ($_tmp0 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->data2 = (int)$_tmp0;
      }
    }
  }

}

/**
 * Original thrift struct:-
 * InnerUnionPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/InnerUnionPatch'))>>
class InnerUnionPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\InnerUnion::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\InnerUnionFieldPatch::class,
    ),
    4 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\InnerUnion::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\InnerUnionFieldPatch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 4,
    'patch' => 6,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\InnerUnion,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\InnerUnionFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\InnerUnion,
    ?'patch' => ?\test\fixtures\patch\InnerUnionFieldPatch,
  );

  const int STRUCTURAL_ID = 1915469083935775747;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.InnerUnion assign
   */
  public ?\test\fixtures\patch\InnerUnion $assign;
  /**
   * Clears any set value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.InnerUnionFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\InnerUnionFieldPatch $patchPrior;
  /**
   * Assigns the value, if not already set to the same field. Applies third.
   *
   * Original thrift field:-
   * 4: module.InnerUnion ensure
   */
  public ?\test\fixtures\patch\InnerUnion $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.InnerUnionFieldPatch patch
   */
  public ?\test\fixtures\patch\InnerUnionFieldPatch $patch;

  public function __construct(?\test\fixtures\patch\InnerUnion $assign = null, ?bool $clear = null, ?\test\fixtures\patch\InnerUnionFieldPatch $patchPrior = null, ?\test\fixtures\patch\InnerUnion $ensure = null, ?\test\fixtures\patch\InnerUnionFieldPatch $patch = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
    );
  }

  public function getName()[]: string {
    return 'InnerUnionPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.InnerUnionPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.InnerUnion",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.InnerUnionFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 4,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.InnerUnion",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.InnerUnionFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::UnionPatchAdapter<::test::fixtures::patch::InnerUnionPatchStruct>",
            "underlyingName" => "InnerUnionPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::InnerUnionFieldPatchStruct>",
                "underlyingName" => "InnerUnionFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::InnerUnionFieldPatchStruct>",
                "underlyingName" => "InnerUnionFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\InnerUnion>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\InnerUnion::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\InnerUnionFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\InnerUnionFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\InnerUnion>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\InnerUnion::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\InnerUnionFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\InnerUnionFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
  }

}

/**
 * Original thrift struct:-
 * InnerUnionFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/InnerUnionFieldPatch'))>>
class InnerUnionFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'innerOption',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\BinaryPatch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'innerOption' => 1,
  ];

  const type TConstructorShape = shape(
    ?'innerOption' => ?\facebook\thrift\op\BinaryPatch,
  );

  const int STRUCTURAL_ID = 7781104017677120443;
  /**
   * Original thrift field:-
   * 1: patch.BinaryPatch innerOption
   */
  public ?\facebook\thrift\op\BinaryPatch $innerOption;

  public function __construct(?\facebook\thrift\op\BinaryPatch $innerOption = null)[] {
    $this->innerOption = $innerOption;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'innerOption'),
    );
  }

  public function getName()[]: string {
    return 'InnerUnionFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->innerOption = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.InnerUnionFieldPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.BinaryPatch",
                    )
                  ),
                )
              ),
              "name" => "innerOption",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::InnerUnionFieldPatchStruct>",
            "underlyingName" => "InnerUnionFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'innerOption' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::BinaryPatchAdapter<::apache::thrift::op::BinaryPatchStruct>",
                "underlyingName" => "BinaryPatchStruct",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'innerOption') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\BinaryPatch>($parsed['innerOption']));
      $_tmp1 = \facebook\thrift\op\BinaryPatch::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->innerOption = $_tmp1;
    }
  }

}

/**
 * Original thrift struct:-
 * MyUnionPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyUnionPatch'))>>
class MyUnionPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyUnion::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyUnionFieldPatch::class,
    ),
    4 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyUnion::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyUnionFieldPatch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 4,
    'patch' => 6,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\MyUnion,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\MyUnionFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\MyUnion,
    ?'patch' => ?\test\fixtures\patch\MyUnionFieldPatch,
  );

  const int STRUCTURAL_ID = 366391298232838551;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.MyUnion assign
   */
  public ?\test\fixtures\patch\MyUnion $assign;
  /**
   * Clears any set value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.MyUnionFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\MyUnionFieldPatch $patchPrior;
  /**
   * Assigns the value, if not already set to the same field. Applies third.
   *
   * Original thrift field:-
   * 4: module.MyUnion ensure
   */
  public ?\test\fixtures\patch\MyUnion $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.MyUnionFieldPatch patch
   */
  public ?\test\fixtures\patch\MyUnionFieldPatch $patch;

  public function __construct(?\test\fixtures\patch\MyUnion $assign = null, ?bool $clear = null, ?\test\fixtures\patch\MyUnionFieldPatch $patchPrior = null, ?\test\fixtures\patch\MyUnion $ensure = null, ?\test\fixtures\patch\MyUnionFieldPatch $patch = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
    );
  }

  public function getName()[]: string {
    return 'MyUnionPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyUnionPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyUnion",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyUnionFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 4,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyUnion",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyUnionFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::UnionPatchAdapter<::test::fixtures::patch::MyUnionPatchStruct>",
            "underlyingName" => "MyUnionPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyUnionFieldPatchStruct>",
                "underlyingName" => "MyUnionFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyUnionFieldPatchStruct>",
                "underlyingName" => "MyUnionFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyUnion>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\MyUnion::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyUnionFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\MyUnionFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyUnion>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\MyUnion::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyUnionFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\MyUnionFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
  }

}

/**
 * Original thrift struct:-
 * MyUnionFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyUnionFieldPatch'))>>
class MyUnionFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'option1',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\StringPatch::class,
    ),
    2 => shape(
      'var' => 'option2',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I32Patch::class,
    ),
    3 => shape(
      'var' => 'option3',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\InnerUnionPatch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'option1' => 1,
    'option2' => 2,
    'option3' => 3,
  ];

  const type TConstructorShape = shape(
    ?'option1' => ?\facebook\thrift\op\StringPatch,
    ?'option2' => ?\facebook\thrift\op\I32Patch,
    ?'option3' => ?\test\fixtures\patch\InnerUnionPatch,
  );

  const int STRUCTURAL_ID = 2282223608803987365;
  /**
   * Original thrift field:-
   * 1: patch.StringPatch option1
   */
  public ?\facebook\thrift\op\StringPatch $option1;
  /**
   * Original thrift field:-
   * 2: patch.I32Patch option2
   */
  public ?\facebook\thrift\op\I32Patch $option2;
  /**
   * Original thrift field:-
   * 3: module.InnerUnionPatch option3
   */
  public ?\test\fixtures\patch\InnerUnionPatch $option3;

  public function __construct(?\facebook\thrift\op\StringPatch $option1 = null, ?\facebook\thrift\op\I32Patch $option2 = null, ?\test\fixtures\patch\InnerUnionPatch $option3 = null)[] {
    $this->option1 = $option1;
    $this->option2 = $option2;
    $this->option3 = $option3;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'option1'),
      Shapes::idx($shape, 'option2'),
      Shapes::idx($shape, 'option3'),
    );
  }

  public function getName()[]: string {
    return 'MyUnionFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->option1 = null;
    $this->option2 = null;
    $this->option3 = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyUnionFieldPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.StringPatch",
                    )
                  ),
                )
              ),
              "name" => "option1",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I32Patch",
                    )
                  ),
                )
              ),
              "name" => "option2",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.InnerUnionPatch",
                    )
                  ),
                )
              ),
              "name" => "option3",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyUnionFieldPatchStruct>",
            "underlyingName" => "MyUnionFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'option1' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StringPatchAdapter<::apache::thrift::op::StringPatchStruct>",
                "underlyingName" => "StringPatchStruct",
              )
            ),
          ],
        ),
        'option2' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I32PatchStruct>",
                "underlyingName" => "I32PatchStruct",
              )
            ),
          ],
        ),
        'option3' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::UnionPatchAdapter<::test::fixtures::patch::InnerUnionPatchStruct>",
                "underlyingName" => "InnerUnionPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'option1') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\StringPatch>($parsed['option1']));
      $_tmp1 = \facebook\thrift\op\StringPatch::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->option1 = $_tmp1;
    }
    if (idx($parsed, 'option2') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I32Patch>($parsed['option2']));
      $_tmp3 = \facebook\thrift\op\I32Patch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->option2 = $_tmp3;
    }
    if (idx($parsed, 'option3') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\InnerUnionPatch>($parsed['option3']));
      $_tmp5 = \test\fixtures\patch\InnerUnionPatch::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->option3 = $_tmp5;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructPatch'))>>
class MyStructPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStruct::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructFieldPatch::class,
    ),
    5 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructEnsureStruct::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructFieldPatch::class,
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 5,
    'patch' => 6,
    'remove' => 7,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\MyStruct,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\MyStructFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\MyStructEnsureStruct,
    ?'patch' => ?\test\fixtures\patch\MyStructFieldPatch,
    ?'remove' => ?Set<int>,
  );

  const int STRUCTURAL_ID = 2180737522386571259;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.MyStruct assign
   */
  public ?\test\fixtures\patch\MyStruct $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.MyStructFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\MyStructFieldPatch $patchPrior;
  /**
   * Initialize fields, using the given defaults. Applies third.
   *
   * Original thrift field:-
   * 5: module.MyStructEnsureStruct ensure
   */
  public ?\test\fixtures\patch\MyStructEnsureStruct $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.MyStructFieldPatch patch
   */
  public ?\test\fixtures\patch\MyStructFieldPatch $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<patch.FieldId> remove
   */
  public Set<int> $remove;

  public function __construct(?\test\fixtures\patch\MyStruct $assign = null, ?bool $clear = null, ?\test\fixtures\patch\MyStructFieldPatch $patchPrior = null, ?\test\fixtures\patch\MyStructEnsureStruct $ensure = null, ?\test\fixtures\patch\MyStructFieldPatch $patch = null, ?Set<int> $remove = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
    $this->remove = $remove ?? Set {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
    );
  }

  public function getName()[]: string {
    return 'MyStructPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
    $this->remove = Set {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStruct",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructEnsureStruct",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "patch.FieldId",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                                    shape(
                                      "name" => "id.FieldId",
                                      "underlyingType" => \tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::MyStructPatchStruct>",
            "underlyingName" => "MyStructPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'assign' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\Testing' => \facebook\thrift\annotation\Testing::fromShape(
              shape(
              )
            ),
          ],
        ),
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyStructFieldPatchStruct>",
                "underlyingName" => "MyStructFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
              shape(
              )
            ),
          ],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyStructFieldPatchStruct>",
                "underlyingName" => "MyStructFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStruct>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\MyStruct::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\MyStructFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructEnsureStruct>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\MyStructEnsureStruct::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\MyStructFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json11 = HH\FIXME\UNSAFE_CAST<mixed, Set<int>>($parsed['remove']);
      $_container12 = Set {};
      foreach($_json11 as $_key9 => $_value10) {
        $_elem13 = 0;
        $_tmp14 = (int)$_value10;
        if ($_tmp14 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem13 = (int)$_tmp14;
        }
        $_container12->add($_elem13);
      }
      $this->remove = $_container12;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField10Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField10Patch'))>>
class MyStructField10Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::I32,
      'enum' => \test\fixtures\patch\MyEnum::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\MyEnum,
    ?'clear' => ?bool,
  );

  const int STRUCTURAL_ID = 4425646384421675469;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.MyEnum assign
   */
  public ?\test\fixtures\patch\MyEnum $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;

  public function __construct(?\test\fixtures\patch\MyEnum $assign = null, ?bool $clear = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField10Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField10Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::MyStructField10PatchStruct>",
            "underlyingName" => "MyStructField10PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $this->assign = \test\fixtures\patch\MyEnum::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyEnum>($parsed['assign']));
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField23Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField23Patch'))>>
class MyStructField23Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::I32,
      'enum' => \test\fixtures\patch\MyEnum::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\MyEnum,
    ?'clear' => ?bool,
  );

  const int STRUCTURAL_ID = 4425646384421675469;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.MyEnum assign
   */
  public ?\test\fixtures\patch\MyEnum $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;

  public function __construct(?\test\fixtures\patch\MyEnum $assign = null, ?bool $clear = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField23Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField23Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::MyStructField23PatchStruct>",
            "underlyingName" => "MyStructField23PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $this->assign = \test\fixtures\patch\MyEnum::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyEnum>($parsed['assign']));
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField26Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField26Patch'))>>
class MyStructField26Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::LST,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    8 => shape(
      'var' => 'prepend',
      'is_terse' => true,
      'type' => \TType::LST,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
    9 => shape(
      'var' => 'append',
      'is_terse' => true,
      'type' => \TType::LST,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'prepend' => 8,
    'append' => 9,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?Vector<int>,
    ?'clear' => ?bool,
    ?'prepend' => ?Vector<int>,
    ?'append' => ?Vector<int>,
  );

  const int STRUCTURAL_ID = 2937022562509798365;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: list<i16> assign
   */
  public ?Vector<int> $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Prepends to the front of a given list.
   *
   * Original thrift field:-
   * 8: list<i16> prepend
   */
  public Vector<int> $prepend;
  /**
   * Appends to the back of a given list.
   *
   * Original thrift field:-
   * 9: list<i16> append
   */
  public Vector<int> $append;

  public function __construct(?Vector<int> $assign = null, ?bool $clear = null, ?Vector<int> $prepend = null, ?Vector<int> $append = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->prepend = $prepend ?? Vector {};
    $this->append = $append ?? Vector {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'prepend'),
      Shapes::idx($shape, 'append'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField26Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->prepend = Vector {};
    $this->append = Vector {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField26Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 8,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "prepend",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "append",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::ListPatchAdapter<::test::fixtures::patch::MyStructField26PatchStruct>",
            "underlyingName" => "MyStructField26PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Vector<int>>($parsed['assign']);
      $_container4 = Vector {};
      foreach($_json3 as $_key1 => $_value2) {
        $_elem5 = 0;
        $_tmp6 = (int)$_value2;
        if ($_tmp6 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem5 = (int)$_tmp6;
        }
        $_container4 []= $_elem5;
      }
      $this->assign = $_container4;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'prepend') !== null) {
      $_json10 = HH\FIXME\UNSAFE_CAST<mixed, Vector<int>>($parsed['prepend']);
      $_container11 = Vector {};
      foreach($_json10 as $_key8 => $_value9) {
        $_elem12 = 0;
        $_tmp13 = (int)$_value9;
        if ($_tmp13 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem12 = (int)$_tmp13;
        }
        $_container11 []= $_elem12;
      }
      $this->prepend = $_container11;
    }
    if (idx($parsed, 'append') !== null) {
      $_json17 = HH\FIXME\UNSAFE_CAST<mixed, Vector<int>>($parsed['append']);
      $_container18 = Vector {};
      foreach($_json17 as $_key15 => $_value16) {
        $_elem19 = 0;
        $_tmp20 = (int)$_value16;
        if ($_tmp20 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem19 = (int)$_tmp20;
        }
        $_container18 []= $_elem19;
      }
      $this->append = $_container18;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField27Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField27Patch'))>>
class MyStructField27Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    8 => shape(
      'var' => 'add',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'remove' => 7,
    'add' => 8,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?Set<string>,
    ?'clear' => ?bool,
    ?'remove' => ?Set<string>,
    ?'add' => ?Set<string>,
  );

  const int STRUCTURAL_ID = 6426013098386337881;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: set<string> assign
   */
  public ?Set<string> $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<string> remove
   */
  public Set<string> $remove;
  /**
   * Adds entries, if not already present. Applies fourth.
   *
   * Original thrift field:-
   * 8: set<string> add
   */
  public Set<string> $add;

  public function __construct(?Set<string> $assign = null, ?bool $clear = null, ?Set<string> $remove = null, ?Set<string> $add = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->remove = $remove ?? Set {};
    $this->add = $add ?? Set {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'remove'),
      Shapes::idx($shape, 'add'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField27Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->remove = Set {};
    $this->add = Set {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField27Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 8,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "add",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::SetPatchAdapter<::test::fixtures::patch::MyStructField27PatchStruct>",
            "underlyingName" => "MyStructField27PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['assign']);
      $_container4 = Set {};
      foreach($_json3 as $_key1 => $_value2) {
        $_elem5 = '';
        $_elem5 = $_value2;
        $_container4->add($_elem5);
      }
      $this->assign = $_container4;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'remove') !== null) {
      $_json9 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['remove']);
      $_container10 = Set {};
      foreach($_json9 as $_key7 => $_value8) {
        $_elem11 = '';
        $_elem11 = $_value8;
        $_container10->add($_elem11);
      }
      $this->remove = $_container10;
    }
    if (idx($parsed, 'add') !== null) {
      $_json15 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['add']);
      $_container16 = Set {};
      foreach($_json15 as $_key13 => $_value14) {
        $_elem17 = '';
        $_elem17 = $_value14;
        $_container16->add($_elem17);
      }
      $this->add = $_container16;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField28Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField28Patch'))>>
class MyStructField28Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRING,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \facebook\thrift\op\StringPatch::class,
      ),
      'format' => 'collection',
    ),
    5 => shape(
      'var' => 'add',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRING,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \facebook\thrift\op\StringPatch::class,
      ),
      'format' => 'collection',
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    9 => shape(
      'var' => 'put',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRING,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'add' => 5,
    'patch' => 6,
    'remove' => 7,
    'put' => 9,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?Map<string, string>,
    ?'clear' => ?bool,
    ?'patchPrior' => ?Map<string, \facebook\thrift\op\StringPatch>,
    ?'add' => ?Map<string, string>,
    ?'patch' => ?Map<string, \facebook\thrift\op\StringPatch>,
    ?'remove' => ?Set<string>,
    ?'put' => ?Map<string, string>,
  );

  const int STRUCTURAL_ID = 1721371192977592724;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: map<string, string> assign
   */
  public ?Map<string, string> $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: map<string, patch.StringPatch> patchPrior
   */
  public Map<string, \facebook\thrift\op\StringPatch> $patchPrior;
  /**
   * Add the given values, if the keys are not already present. Applies forth.
   *
   * Original thrift field:-
   * 5: map<string, string> add
   */
  public Map<string, string> $add;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: map<string, patch.StringPatch> patch
   */
  public Map<string, \facebook\thrift\op\StringPatch> $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<string> remove
   */
  public Set<string> $remove;
  /**
   * Adds or replaces the given key/value pairs. Applies fifth.
   *
   * Original thrift field:-
   * 9: map<string, string> put
   */
  public Map<string, string> $put;

  public function __construct(?Map<string, string> $assign = null, ?bool $clear = null, ?Map<string, \facebook\thrift\op\StringPatch> $patchPrior = null, ?Map<string, string> $add = null, ?Map<string, \facebook\thrift\op\StringPatch> $patch = null, ?Set<string> $remove = null, ?Map<string, string> $put = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior ?? Map {};
    $this->add = $add ?? Map {};
    $this->patch = $patch ?? Map {};
    $this->remove = $remove ?? Set {};
    $this->put = $put ?? Map {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'add'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
      Shapes::idx($shape, 'put'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField28Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = Map {};
    $this->add = Map {};
    $this->patch = Map {};
    $this->remove = Set {};
    $this->put = Map {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField28Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "patch.StringPatch",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "add",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "patch.StringPatch",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "put",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::MapPatchAdapter<::test::fixtures::patch::MyStructField28PatchStruct>",
            "underlyingName" => "MyStructField28PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, string>>($parsed['assign']);
      $_container4 = Map {};
      foreach($_json3 as $_key1 => $_value2) {
        $_value5 = '';
        $_value5 = $_value2;
        $_container4[$_key1] = $_value5;
      }
      $this->assign = $_container4;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_json9 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \facebook\thrift\op\StringPatch>>($parsed['patchPrior']);
      $_container10 = Map {};
      foreach($_json9 as $_key7 => $_value8) {
        $_value11 = \facebook\thrift\op\StringPatch::withDefaultValues();
        $_tmp12 = \json_encode($_value8);
        $_tmp13 = \facebook\thrift\op\StringPatch::withDefaultValues();
        $_tmp13->readFromJson($_tmp12);
        $_value11 = $_tmp13;
        $_container10[$_key7] = $_value11;
      }
      $this->patchPrior = $_container10;
    }
    if (idx($parsed, 'add') !== null) {
      $_json17 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, string>>($parsed['add']);
      $_container18 = Map {};
      foreach($_json17 as $_key15 => $_value16) {
        $_value19 = '';
        $_value19 = $_value16;
        $_container18[$_key15] = $_value19;
      }
      $this->add = $_container18;
    }
    if (idx($parsed, 'patch') !== null) {
      $_json23 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \facebook\thrift\op\StringPatch>>($parsed['patch']);
      $_container24 = Map {};
      foreach($_json23 as $_key21 => $_value22) {
        $_value25 = \facebook\thrift\op\StringPatch::withDefaultValues();
        $_tmp26 = \json_encode($_value22);
        $_tmp27 = \facebook\thrift\op\StringPatch::withDefaultValues();
        $_tmp27->readFromJson($_tmp26);
        $_value25 = $_tmp27;
        $_container24[$_key21] = $_value25;
      }
      $this->patch = $_container24;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json31 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['remove']);
      $_container32 = Set {};
      foreach($_json31 as $_key29 => $_value30) {
        $_elem33 = '';
        $_elem33 = $_value30;
        $_container32->add($_elem33);
      }
      $this->remove = $_container32;
    }
    if (idx($parsed, 'put') !== null) {
      $_json37 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, string>>($parsed['put']);
      $_container38 = Map {};
      foreach($_json37 as $_key35 => $_value36) {
        $_value39 = '';
        $_value39 = $_value36;
        $_container38[$_key35] = $_value39;
      }
      $this->put = $_container38;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField29Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField29Patch'))>>
class MyStructField29Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    8 => shape(
      'var' => 'prepend',
      'is_terse' => true,
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    9 => shape(
      'var' => 'append',
      'is_terse' => true,
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'prepend' => 8,
    'append' => 9,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?Vector<Map<string, int>>,
    ?'clear' => ?bool,
    ?'prepend' => ?Vector<Map<string, int>>,
    ?'append' => ?Vector<Map<string, int>>,
  );

  const int STRUCTURAL_ID = 2937022562509798365;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: list<map<string, i32>> assign
   */
  public ?Vector<Map<string, int>> $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Prepends to the front of a given list.
   *
   * Original thrift field:-
   * 8: list<map<string, i32>> prepend
   */
  public Vector<Map<string, int>> $prepend;
  /**
   * Appends to the back of a given list.
   *
   * Original thrift field:-
   * 9: list<map<string, i32>> append
   */
  public Vector<Map<string, int>> $append;

  public function __construct(?Vector<Map<string, int>> $assign = null, ?bool $clear = null, ?Vector<Map<string, int>> $prepend = null, ?Vector<Map<string, int>> $append = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->prepend = $prepend ?? Vector {};
    $this->append = $append ?? Vector {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'prepend'),
      Shapes::idx($shape, 'append'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField29Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->prepend = Vector {};
    $this->append = Vector {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField29Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 8,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "prepend",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "append",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::ListPatchAdapter<::test::fixtures::patch::MyStructField29PatchStruct>",
            "underlyingName" => "MyStructField29PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Vector<Map<string, int>>>($parsed['assign']);
      $_container4 = Vector {};
      foreach($_json3 as $_key1 => $_value2) {
        $_elem5 = Map {};
        $_json9 = $_value2;
        $_container10 = Map {};
        foreach($_json9 as $_key7 => $_value8) {
          $_value11 = 0;
          $_tmp12 = (int)$_value8;
          if ($_tmp12 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value11 = (int)$_tmp12;
          }
          $_container10[$_key7] = $_value11;
        }
        $_elem5 = $_container10;
        $_container4 []= $_elem5;
      }
      $this->assign = $_container4;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'prepend') !== null) {
      $_json16 = HH\FIXME\UNSAFE_CAST<mixed, Vector<Map<string, int>>>($parsed['prepend']);
      $_container17 = Vector {};
      foreach($_json16 as $_key14 => $_value15) {
        $_elem18 = Map {};
        $_json22 = $_value15;
        $_container23 = Map {};
        foreach($_json22 as $_key20 => $_value21) {
          $_value24 = 0;
          $_tmp25 = (int)$_value21;
          if ($_tmp25 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value24 = (int)$_tmp25;
          }
          $_container23[$_key20] = $_value24;
        }
        $_elem18 = $_container23;
        $_container17 []= $_elem18;
      }
      $this->prepend = $_container17;
    }
    if (idx($parsed, 'append') !== null) {
      $_json29 = HH\FIXME\UNSAFE_CAST<mixed, Vector<Map<string, int>>>($parsed['append']);
      $_container30 = Vector {};
      foreach($_json29 as $_key27 => $_value28) {
        $_elem31 = Map {};
        $_json35 = $_value28;
        $_container36 = Map {};
        foreach($_json35 as $_key33 => $_value34) {
          $_value37 = 0;
          $_tmp38 = (int)$_value34;
          if ($_tmp38 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value37 = (int)$_tmp38;
          }
          $_container36[$_key33] = $_value37;
        }
        $_elem31 = $_container36;
        $_container30 []= $_elem31;
      }
      $this->append = $_container30;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField30Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField30Patch'))>>
class MyStructField30Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::MAP,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \test\fixtures\patch\MyStructField30Patch1::class,
      ),
      'format' => 'collection',
    ),
    5 => shape(
      'var' => 'add',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::MAP,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \test\fixtures\patch\MyStructField30Patch1::class,
      ),
      'format' => 'collection',
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    9 => shape(
      'var' => 'put',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::MAP,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'add' => 5,
    'patch' => 6,
    'remove' => 7,
    'put' => 9,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?Map<string, Map<string, int>>,
    ?'clear' => ?bool,
    ?'patchPrior' => ?Map<string, \test\fixtures\patch\MyStructField30Patch1>,
    ?'add' => ?Map<string, Map<string, int>>,
    ?'patch' => ?Map<string, \test\fixtures\patch\MyStructField30Patch1>,
    ?'remove' => ?Set<string>,
    ?'put' => ?Map<string, Map<string, int>>,
  );

  const int STRUCTURAL_ID = 1721371192977592724;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: map<string, map<string, i32>> assign
   */
  public ?Map<string, Map<string, int>> $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: map<string, module.MyStructField30Patch1> patchPrior
   */
  public Map<string, \test\fixtures\patch\MyStructField30Patch1> $patchPrior;
  /**
   * Add the given values, if the keys are not already present. Applies forth.
   *
   * Original thrift field:-
   * 5: map<string, map<string, i32>> add
   */
  public Map<string, Map<string, int>> $add;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: map<string, module.MyStructField30Patch1> patch
   */
  public Map<string, \test\fixtures\patch\MyStructField30Patch1> $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<string> remove
   */
  public Set<string> $remove;
  /**
   * Adds or replaces the given key/value pairs. Applies fifth.
   *
   * Original thrift field:-
   * 9: map<string, map<string, i32>> put
   */
  public Map<string, Map<string, int>> $put;

  public function __construct(?Map<string, Map<string, int>> $assign = null, ?bool $clear = null, ?Map<string, \test\fixtures\patch\MyStructField30Patch1> $patchPrior = null, ?Map<string, Map<string, int>> $add = null, ?Map<string, \test\fixtures\patch\MyStructField30Patch1> $patch = null, ?Set<string> $remove = null, ?Map<string, Map<string, int>> $put = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior ?? Map {};
    $this->add = $add ?? Map {};
    $this->patch = $patch ?? Map {};
    $this->remove = $remove ?? Set {};
    $this->put = $put ?? Map {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'add'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
      Shapes::idx($shape, 'put'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField30Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = Map {};
    $this->add = Map {};
    $this->patch = Map {};
    $this->remove = Set {};
    $this->put = Map {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField30Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.MyStructField30Patch1",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "add",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.MyStructField30Patch1",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "put",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::MapPatchAdapter<::test::fixtures::patch::MyStructField30PatchStruct>",
            "underlyingName" => "MyStructField30PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, Map<string, int>>>($parsed['assign']);
      $_container4 = Map {};
      foreach($_json3 as $_key1 => $_value2) {
        $_value5 = Map {};
        $_json9 = $_value2;
        $_container10 = Map {};
        foreach($_json9 as $_key7 => $_value8) {
          $_value11 = 0;
          $_tmp12 = (int)$_value8;
          if ($_tmp12 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value11 = (int)$_tmp12;
          }
          $_container10[$_key7] = $_value11;
        }
        $_value5 = $_container10;
        $_container4[$_key1] = $_value5;
      }
      $this->assign = $_container4;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_json16 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \test\fixtures\patch\MyStructField30Patch1>>($parsed['patchPrior']);
      $_container17 = Map {};
      foreach($_json16 as $_key14 => $_value15) {
        $_value18 = \test\fixtures\patch\MyStructField30Patch1::withDefaultValues();
        $_tmp19 = \json_encode($_value15);
        $_tmp20 = \test\fixtures\patch\MyStructField30Patch1::withDefaultValues();
        $_tmp20->readFromJson($_tmp19);
        $_value18 = $_tmp20;
        $_container17[$_key14] = $_value18;
      }
      $this->patchPrior = $_container17;
    }
    if (idx($parsed, 'add') !== null) {
      $_json24 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, Map<string, int>>>($parsed['add']);
      $_container25 = Map {};
      foreach($_json24 as $_key22 => $_value23) {
        $_value26 = Map {};
        $_json30 = $_value23;
        $_container31 = Map {};
        foreach($_json30 as $_key28 => $_value29) {
          $_value32 = 0;
          $_tmp33 = (int)$_value29;
          if ($_tmp33 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value32 = (int)$_tmp33;
          }
          $_container31[$_key28] = $_value32;
        }
        $_value26 = $_container31;
        $_container25[$_key22] = $_value26;
      }
      $this->add = $_container25;
    }
    if (idx($parsed, 'patch') !== null) {
      $_json37 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \test\fixtures\patch\MyStructField30Patch1>>($parsed['patch']);
      $_container38 = Map {};
      foreach($_json37 as $_key35 => $_value36) {
        $_value39 = \test\fixtures\patch\MyStructField30Patch1::withDefaultValues();
        $_tmp40 = \json_encode($_value36);
        $_tmp41 = \test\fixtures\patch\MyStructField30Patch1::withDefaultValues();
        $_tmp41->readFromJson($_tmp40);
        $_value39 = $_tmp41;
        $_container38[$_key35] = $_value39;
      }
      $this->patch = $_container38;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json45 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['remove']);
      $_container46 = Set {};
      foreach($_json45 as $_key43 => $_value44) {
        $_elem47 = '';
        $_elem47 = $_value44;
        $_container46->add($_elem47);
      }
      $this->remove = $_container46;
    }
    if (idx($parsed, 'put') !== null) {
      $_json51 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, Map<string, int>>>($parsed['put']);
      $_container52 = Map {};
      foreach($_json51 as $_key49 => $_value50) {
        $_value53 = Map {};
        $_json57 = $_value50;
        $_container58 = Map {};
        foreach($_json57 as $_key55 => $_value56) {
          $_value59 = 0;
          $_tmp60 = (int)$_value56;
          if ($_tmp60 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value59 = (int)$_tmp60;
          }
          $_container58[$_key55] = $_value59;
        }
        $_value53 = $_container58;
        $_container52[$_key49] = $_value53;
      }
      $this->put = $_container52;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructField30Patch1
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructField30Patch1'))>>
class MyStructField30Patch1 implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::I32,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \facebook\thrift\op\I32Patch::class,
      ),
      'format' => 'collection',
    ),
    5 => shape(
      'var' => 'add',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::I32,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \facebook\thrift\op\I32Patch::class,
      ),
      'format' => 'collection',
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    9 => shape(
      'var' => 'put',
      'is_terse' => true,
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::I32,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'add' => 5,
    'patch' => 6,
    'remove' => 7,
    'put' => 9,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?Map<string, int>,
    ?'clear' => ?bool,
    ?'patchPrior' => ?Map<string, \facebook\thrift\op\I32Patch>,
    ?'add' => ?Map<string, int>,
    ?'patch' => ?Map<string, \facebook\thrift\op\I32Patch>,
    ?'remove' => ?Set<string>,
    ?'put' => ?Map<string, int>,
  );

  const int STRUCTURAL_ID = 1721371192977592724;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: map<string, i32> assign
   */
  public ?Map<string, int> $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: map<string, patch.I32Patch> patchPrior
   */
  public Map<string, \facebook\thrift\op\I32Patch> $patchPrior;
  /**
   * Add the given values, if the keys are not already present. Applies forth.
   *
   * Original thrift field:-
   * 5: map<string, i32> add
   */
  public Map<string, int> $add;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: map<string, patch.I32Patch> patch
   */
  public Map<string, \facebook\thrift\op\I32Patch> $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<string> remove
   */
  public Set<string> $remove;
  /**
   * Adds or replaces the given key/value pairs. Applies fifth.
   *
   * Original thrift field:-
   * 9: map<string, i32> put
   */
  public Map<string, int> $put;

  public function __construct(?Map<string, int> $assign = null, ?bool $clear = null, ?Map<string, \facebook\thrift\op\I32Patch> $patchPrior = null, ?Map<string, int> $add = null, ?Map<string, \facebook\thrift\op\I32Patch> $patch = null, ?Set<string> $remove = null, ?Map<string, int> $put = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior ?? Map {};
    $this->add = $add ?? Map {};
    $this->patch = $patch ?? Map {};
    $this->remove = $remove ?? Set {};
    $this->put = $put ?? Map {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'add'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
      Shapes::idx($shape, 'put'),
    );
  }

  public function getName()[]: string {
    return 'MyStructField30Patch1';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = Map {};
    $this->add = Map {};
    $this->patch = Map {};
    $this->remove = Set {};
    $this->put = Map {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructField30Patch1",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "patch.I32Patch",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "add",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "patch.I32Patch",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "put",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::MapPatchAdapter<::test::fixtures::patch::MyStructField30Patch1Struct>",
            "underlyingName" => "MyStructField30Patch1Struct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, int>>($parsed['assign']);
      $_container4 = Map {};
      foreach($_json3 as $_key1 => $_value2) {
        $_value5 = 0;
        $_tmp6 = (int)$_value2;
        if ($_tmp6 > 0x7fffffff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_value5 = (int)$_tmp6;
        }
        $_container4[$_key1] = $_value5;
      }
      $this->assign = $_container4;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_json10 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \facebook\thrift\op\I32Patch>>($parsed['patchPrior']);
      $_container11 = Map {};
      foreach($_json10 as $_key8 => $_value9) {
        $_value12 = \facebook\thrift\op\I32Patch::withDefaultValues();
        $_tmp13 = \json_encode($_value9);
        $_tmp14 = \facebook\thrift\op\I32Patch::withDefaultValues();
        $_tmp14->readFromJson($_tmp13);
        $_value12 = $_tmp14;
        $_container11[$_key8] = $_value12;
      }
      $this->patchPrior = $_container11;
    }
    if (idx($parsed, 'add') !== null) {
      $_json18 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, int>>($parsed['add']);
      $_container19 = Map {};
      foreach($_json18 as $_key16 => $_value17) {
        $_value20 = 0;
        $_tmp21 = (int)$_value17;
        if ($_tmp21 > 0x7fffffff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_value20 = (int)$_tmp21;
        }
        $_container19[$_key16] = $_value20;
      }
      $this->add = $_container19;
    }
    if (idx($parsed, 'patch') !== null) {
      $_json25 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \facebook\thrift\op\I32Patch>>($parsed['patch']);
      $_container26 = Map {};
      foreach($_json25 as $_key23 => $_value24) {
        $_value27 = \facebook\thrift\op\I32Patch::withDefaultValues();
        $_tmp28 = \json_encode($_value24);
        $_tmp29 = \facebook\thrift\op\I32Patch::withDefaultValues();
        $_tmp29->readFromJson($_tmp28);
        $_value27 = $_tmp29;
        $_container26[$_key23] = $_value27;
      }
      $this->patch = $_container26;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json33 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['remove']);
      $_container34 = Set {};
      foreach($_json33 as $_key31 => $_value32) {
        $_elem35 = '';
        $_elem35 = $_value32;
        $_container34->add($_elem35);
      }
      $this->remove = $_container34;
    }
    if (idx($parsed, 'put') !== null) {
      $_json39 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, int>>($parsed['put']);
      $_container40 = Map {};
      foreach($_json39 as $_key37 => $_value38) {
        $_value41 = 0;
        $_tmp42 = (int)$_value38;
        if ($_tmp42 > 0x7fffffff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_value41 = (int)$_tmp42;
        }
        $_container40[$_key37] = $_value41;
      }
      $this->put = $_container40;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructFieldPatch'))>>
class MyStructFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -32 => shape(
      'var' => 'structWithCustomDefault',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataWithCustomDefaultPatch::class,
    ),
    -31 => shape(
      'var' => 'i32WithCustomDefault',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I32Patch::class,
    ),
    -30 => shape(
      'var' => 'mapMap',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructField30Patch::class,
    ),
    -29 => shape(
      'var' => 'listMap',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructField29Patch::class,
    ),
    -28 => shape(
      'var' => 'optMapVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructField28Patch::class,
    ),
    -27 => shape(
      'var' => 'optSetVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructField27Patch::class,
    ),
    -26 => shape(
      'var' => 'optListVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructField26Patch::class,
    ),
    -25 => shape(
      'var' => 'optLateStructVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStructPatch::class,
    ),
    -24 => shape(
      'var' => 'optStructVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataPatch::class,
    ),
    -23 => shape(
      'var' => 'optEnumVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructField23Patch::class,
    ),
    -22 => shape(
      'var' => 'optBinaryVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\BinaryPatch::class,
    ),
    -21 => shape(
      'var' => 'optStringVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\StringPatch::class,
    ),
    -20 => shape(
      'var' => 'optDoubleVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\DoublePatch::class,
    ),
    -19 => shape(
      'var' => 'optFloatVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\FloatPatch::class,
    ),
    -18 => shape(
      'var' => 'optI64Val',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I64Patch::class,
    ),
    -17 => shape(
      'var' => 'optI32Val',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I32Patch::class,
    ),
    -16 => shape(
      'var' => 'optI16Val',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I16Patch::class,
    ),
    -15 => shape(
      'var' => 'optByteVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\BytePatch::class,
    ),
    -14 => shape(
      'var' => 'optBoolVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\BoolPatch::class,
    ),
    -13 => shape(
      'var' => 'lateStructVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStructPatch::class,
    ),
    -12 => shape(
      'var' => 'unionVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyUnionPatch::class,
    ),
    -11 => shape(
      'var' => 'structVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataPatch::class,
    ),
    -10 => shape(
      'var' => 'enumVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyStructField10Patch::class,
    ),
    -9 => shape(
      'var' => 'binaryVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\BinaryPatch::class,
    ),
    -8 => shape(
      'var' => 'stringVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\StringPatch::class,
    ),
    -7 => shape(
      'var' => 'doubleVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\DoublePatch::class,
    ),
    -6 => shape(
      'var' => 'floatVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\FloatPatch::class,
    ),
    -5 => shape(
      'var' => 'i64Val',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I64Patch::class,
    ),
    -4 => shape(
      'var' => 'i32Val',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I32Patch::class,
    ),
    -3 => shape(
      'var' => 'i16Val',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\I16Patch::class,
    ),
    -2 => shape(
      'var' => 'byteVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\BytePatch::class,
    ),
    -1 => shape(
      'var' => 'boolVal',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \facebook\thrift\op\BoolPatch::class,
    ),
    1 => shape(
      'var' => 'structWithFieldCustomDefault',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataPatch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'structWithCustomDefault' => -32,
    'i32WithCustomDefault' => -31,
    'mapMap' => -30,
    'listMap' => -29,
    'optMapVal' => -28,
    'optSetVal' => -27,
    'optListVal' => -26,
    'optLateStructVal' => -25,
    'optStructVal' => -24,
    'optEnumVal' => -23,
    'optBinaryVal' => -22,
    'optStringVal' => -21,
    'optDoubleVal' => -20,
    'optFloatVal' => -19,
    'optI64Val' => -18,
    'optI32Val' => -17,
    'optI16Val' => -16,
    'optByteVal' => -15,
    'optBoolVal' => -14,
    'lateStructVal' => -13,
    'unionVal' => -12,
    'structVal' => -11,
    'enumVal' => -10,
    'binaryVal' => -9,
    'stringVal' => -8,
    'doubleVal' => -7,
    'floatVal' => -6,
    'i64Val' => -5,
    'i32Val' => -4,
    'i16Val' => -3,
    'byteVal' => -2,
    'boolVal' => -1,
    'structWithFieldCustomDefault' => 1,
  ];

  const type TConstructorShape = shape(
    ?'structWithCustomDefault' => ?\test\fixtures\patch\MyDataWithCustomDefaultPatch,
    ?'i32WithCustomDefault' => ?\facebook\thrift\op\I32Patch,
    ?'mapMap' => ?\test\fixtures\patch\MyStructField30Patch,
    ?'listMap' => ?\test\fixtures\patch\MyStructField29Patch,
    ?'optMapVal' => ?\test\fixtures\patch\MyStructField28Patch,
    ?'optSetVal' => ?\test\fixtures\patch\MyStructField27Patch,
    ?'optListVal' => ?\test\fixtures\patch\MyStructField26Patch,
    ?'optLateStructVal' => ?\test\fixtures\patch\LateDefStructPatch,
    ?'optStructVal' => ?\test\fixtures\patch\MyDataPatch,
    ?'optEnumVal' => ?\test\fixtures\patch\MyStructField23Patch,
    ?'optBinaryVal' => ?\facebook\thrift\op\BinaryPatch,
    ?'optStringVal' => ?\facebook\thrift\op\StringPatch,
    ?'optDoubleVal' => ?\facebook\thrift\op\DoublePatch,
    ?'optFloatVal' => ?\facebook\thrift\op\FloatPatch,
    ?'optI64Val' => ?\facebook\thrift\op\I64Patch,
    ?'optI32Val' => ?\facebook\thrift\op\I32Patch,
    ?'optI16Val' => ?\facebook\thrift\op\I16Patch,
    ?'optByteVal' => ?\facebook\thrift\op\BytePatch,
    ?'optBoolVal' => ?\facebook\thrift\op\BoolPatch,
    ?'lateStructVal' => ?\test\fixtures\patch\LateDefStructPatch,
    ?'unionVal' => ?\test\fixtures\patch\MyUnionPatch,
    ?'structVal' => ?\test\fixtures\patch\MyDataPatch,
    ?'enumVal' => ?\test\fixtures\patch\MyStructField10Patch,
    ?'binaryVal' => ?\facebook\thrift\op\BinaryPatch,
    ?'stringVal' => ?\facebook\thrift\op\StringPatch,
    ?'doubleVal' => ?\facebook\thrift\op\DoublePatch,
    ?'floatVal' => ?\facebook\thrift\op\FloatPatch,
    ?'i64Val' => ?\facebook\thrift\op\I64Patch,
    ?'i32Val' => ?\facebook\thrift\op\I32Patch,
    ?'i16Val' => ?\facebook\thrift\op\I16Patch,
    ?'byteVal' => ?\facebook\thrift\op\BytePatch,
    ?'boolVal' => ?\facebook\thrift\op\BoolPatch,
    ?'structWithFieldCustomDefault' => ?\test\fixtures\patch\MyDataPatch,
  );

  const int STRUCTURAL_ID = 2177152892435994657;
  /**
   * Original thrift field:-
   * -32: module.MyDataWithCustomDefaultPatch structWithCustomDefault
   */
  public ?\test\fixtures\patch\MyDataWithCustomDefaultPatch $structWithCustomDefault;
  /**
   * Original thrift field:-
   * -31: patch.I32Patch i32WithCustomDefault
   */
  public ?\facebook\thrift\op\I32Patch $i32WithCustomDefault;
  /**
   * Original thrift field:-
   * -30: module.MyStructField30Patch mapMap
   */
  public ?\test\fixtures\patch\MyStructField30Patch $mapMap;
  /**
   * Original thrift field:-
   * -29: module.MyStructField29Patch listMap
   */
  public ?\test\fixtures\patch\MyStructField29Patch $listMap;
  /**
   * Original thrift field:-
   * -28: module.MyStructField28Patch optMapVal
   */
  public ?\test\fixtures\patch\MyStructField28Patch $optMapVal;
  /**
   * Original thrift field:-
   * -27: module.MyStructField27Patch optSetVal
   */
  public ?\test\fixtures\patch\MyStructField27Patch $optSetVal;
  /**
   * Original thrift field:-
   * -26: module.MyStructField26Patch optListVal
   */
  public ?\test\fixtures\patch\MyStructField26Patch $optListVal;
  /**
   * Original thrift field:-
   * -25: module.LateDefStructPatch optLateStructVal
   */
  public ?\test\fixtures\patch\LateDefStructPatch $optLateStructVal;
  /**
   * Original thrift field:-
   * -24: module.MyDataPatch optStructVal
   */
  public ?\test\fixtures\patch\MyDataPatch $optStructVal;
  /**
   * Original thrift field:-
   * -23: module.MyStructField23Patch optEnumVal
   */
  public ?\test\fixtures\patch\MyStructField23Patch $optEnumVal;
  /**
   * Original thrift field:-
   * -22: patch.BinaryPatch optBinaryVal
   */
  public ?\facebook\thrift\op\BinaryPatch $optBinaryVal;
  /**
   * Original thrift field:-
   * -21: patch.StringPatch optStringVal
   */
  public ?\facebook\thrift\op\StringPatch $optStringVal;
  /**
   * Original thrift field:-
   * -20: patch.DoublePatch optDoubleVal
   */
  public ?\facebook\thrift\op\DoublePatch $optDoubleVal;
  /**
   * Original thrift field:-
   * -19: patch.FloatPatch optFloatVal
   */
  public ?\facebook\thrift\op\FloatPatch $optFloatVal;
  /**
   * Original thrift field:-
   * -18: patch.I64Patch optI64Val
   */
  public ?\facebook\thrift\op\I64Patch $optI64Val;
  /**
   * Original thrift field:-
   * -17: patch.I32Patch optI32Val
   */
  public ?\facebook\thrift\op\I32Patch $optI32Val;
  /**
   * Original thrift field:-
   * -16: patch.I16Patch optI16Val
   */
  public ?\facebook\thrift\op\I16Patch $optI16Val;
  /**
   * Original thrift field:-
   * -15: patch.BytePatch optByteVal
   */
  public ?\facebook\thrift\op\BytePatch $optByteVal;
  /**
   * Original thrift field:-
   * -14: patch.BoolPatch optBoolVal
   */
  public ?\facebook\thrift\op\BoolPatch $optBoolVal;
  /**
   * Original thrift field:-
   * -13: module.LateDefStructPatch lateStructVal
   */
  public ?\test\fixtures\patch\LateDefStructPatch $lateStructVal;
  /**
   * Original thrift field:-
   * -12: module.MyUnionPatch unionVal
   */
  public ?\test\fixtures\patch\MyUnionPatch $unionVal;
  /**
   * Original thrift field:-
   * -11: module.MyDataPatch structVal
   */
  public ?\test\fixtures\patch\MyDataPatch $structVal;
  /**
   * Original thrift field:-
   * -10: module.MyStructField10Patch enumVal
   */
  public ?\test\fixtures\patch\MyStructField10Patch $enumVal;
  /**
   * Original thrift field:-
   * -9: patch.BinaryPatch binaryVal
   */
  public ?\facebook\thrift\op\BinaryPatch $binaryVal;
  /**
   * Original thrift field:-
   * -8: patch.StringPatch stringVal
   */
  public ?\facebook\thrift\op\StringPatch $stringVal;
  /**
   * Original thrift field:-
   * -7: patch.DoublePatch doubleVal
   */
  public ?\facebook\thrift\op\DoublePatch $doubleVal;
  /**
   * Original thrift field:-
   * -6: patch.FloatPatch floatVal
   */
  public ?\facebook\thrift\op\FloatPatch $floatVal;
  /**
   * Original thrift field:-
   * -5: patch.I64Patch i64Val
   */
  public ?\facebook\thrift\op\I64Patch $i64Val;
  /**
   * Original thrift field:-
   * -4: patch.I32Patch i32Val
   */
  public ?\facebook\thrift\op\I32Patch $i32Val;
  /**
   * Original thrift field:-
   * -3: patch.I16Patch i16Val
   */
  public ?\facebook\thrift\op\I16Patch $i16Val;
  /**
   * Original thrift field:-
   * -2: patch.BytePatch byteVal
   */
  public ?\facebook\thrift\op\BytePatch $byteVal;
  /**
   * Original thrift field:-
   * -1: patch.BoolPatch boolVal
   */
  public ?\facebook\thrift\op\BoolPatch $boolVal;
  /**
   * Original thrift field:-
   * 1: module.MyDataPatch structWithFieldCustomDefault
   */
  public ?\test\fixtures\patch\MyDataPatch $structWithFieldCustomDefault;

  public function __construct(?\test\fixtures\patch\MyDataWithCustomDefaultPatch $structWithCustomDefault = null, ?\facebook\thrift\op\I32Patch $i32WithCustomDefault = null, ?\test\fixtures\patch\MyStructField30Patch $mapMap = null, ?\test\fixtures\patch\MyStructField29Patch $listMap = null, ?\test\fixtures\patch\MyStructField28Patch $optMapVal = null, ?\test\fixtures\patch\MyStructField27Patch $optSetVal = null, ?\test\fixtures\patch\MyStructField26Patch $optListVal = null, ?\test\fixtures\patch\LateDefStructPatch $optLateStructVal = null, ?\test\fixtures\patch\MyDataPatch $optStructVal = null, ?\test\fixtures\patch\MyStructField23Patch $optEnumVal = null, ?\facebook\thrift\op\BinaryPatch $optBinaryVal = null, ?\facebook\thrift\op\StringPatch $optStringVal = null, ?\facebook\thrift\op\DoublePatch $optDoubleVal = null, ?\facebook\thrift\op\FloatPatch $optFloatVal = null, ?\facebook\thrift\op\I64Patch $optI64Val = null, ?\facebook\thrift\op\I32Patch $optI32Val = null, ?\facebook\thrift\op\I16Patch $optI16Val = null, ?\facebook\thrift\op\BytePatch $optByteVal = null, ?\facebook\thrift\op\BoolPatch $optBoolVal = null, ?\test\fixtures\patch\LateDefStructPatch $lateStructVal = null, ?\test\fixtures\patch\MyUnionPatch $unionVal = null, ?\test\fixtures\patch\MyDataPatch $structVal = null, ?\test\fixtures\patch\MyStructField10Patch $enumVal = null, ?\facebook\thrift\op\BinaryPatch $binaryVal = null, ?\facebook\thrift\op\StringPatch $stringVal = null, ?\facebook\thrift\op\DoublePatch $doubleVal = null, ?\facebook\thrift\op\FloatPatch $floatVal = null, ?\facebook\thrift\op\I64Patch $i64Val = null, ?\facebook\thrift\op\I32Patch $i32Val = null, ?\facebook\thrift\op\I16Patch $i16Val = null, ?\facebook\thrift\op\BytePatch $byteVal = null, ?\facebook\thrift\op\BoolPatch $boolVal = null, ?\test\fixtures\patch\MyDataPatch $structWithFieldCustomDefault = null)[] {
    $this->structWithCustomDefault = $structWithCustomDefault;
    $this->i32WithCustomDefault = $i32WithCustomDefault;
    $this->mapMap = $mapMap;
    $this->listMap = $listMap;
    $this->optMapVal = $optMapVal;
    $this->optSetVal = $optSetVal;
    $this->optListVal = $optListVal;
    $this->optLateStructVal = $optLateStructVal;
    $this->optStructVal = $optStructVal;
    $this->optEnumVal = $optEnumVal;
    $this->optBinaryVal = $optBinaryVal;
    $this->optStringVal = $optStringVal;
    $this->optDoubleVal = $optDoubleVal;
    $this->optFloatVal = $optFloatVal;
    $this->optI64Val = $optI64Val;
    $this->optI32Val = $optI32Val;
    $this->optI16Val = $optI16Val;
    $this->optByteVal = $optByteVal;
    $this->optBoolVal = $optBoolVal;
    $this->lateStructVal = $lateStructVal;
    $this->unionVal = $unionVal;
    $this->structVal = $structVal;
    $this->enumVal = $enumVal;
    $this->binaryVal = $binaryVal;
    $this->stringVal = $stringVal;
    $this->doubleVal = $doubleVal;
    $this->floatVal = $floatVal;
    $this->i64Val = $i64Val;
    $this->i32Val = $i32Val;
    $this->i16Val = $i16Val;
    $this->byteVal = $byteVal;
    $this->boolVal = $boolVal;
    $this->structWithFieldCustomDefault = $structWithFieldCustomDefault;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'structWithCustomDefault'),
      Shapes::idx($shape, 'i32WithCustomDefault'),
      Shapes::idx($shape, 'mapMap'),
      Shapes::idx($shape, 'listMap'),
      Shapes::idx($shape, 'optMapVal'),
      Shapes::idx($shape, 'optSetVal'),
      Shapes::idx($shape, 'optListVal'),
      Shapes::idx($shape, 'optLateStructVal'),
      Shapes::idx($shape, 'optStructVal'),
      Shapes::idx($shape, 'optEnumVal'),
      Shapes::idx($shape, 'optBinaryVal'),
      Shapes::idx($shape, 'optStringVal'),
      Shapes::idx($shape, 'optDoubleVal'),
      Shapes::idx($shape, 'optFloatVal'),
      Shapes::idx($shape, 'optI64Val'),
      Shapes::idx($shape, 'optI32Val'),
      Shapes::idx($shape, 'optI16Val'),
      Shapes::idx($shape, 'optByteVal'),
      Shapes::idx($shape, 'optBoolVal'),
      Shapes::idx($shape, 'lateStructVal'),
      Shapes::idx($shape, 'unionVal'),
      Shapes::idx($shape, 'structVal'),
      Shapes::idx($shape, 'enumVal'),
      Shapes::idx($shape, 'binaryVal'),
      Shapes::idx($shape, 'stringVal'),
      Shapes::idx($shape, 'doubleVal'),
      Shapes::idx($shape, 'floatVal'),
      Shapes::idx($shape, 'i64Val'),
      Shapes::idx($shape, 'i32Val'),
      Shapes::idx($shape, 'i16Val'),
      Shapes::idx($shape, 'byteVal'),
      Shapes::idx($shape, 'boolVal'),
      Shapes::idx($shape, 'structWithFieldCustomDefault'),
    );
  }

  public function getName()[]: string {
    return 'MyStructFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->structWithCustomDefault = null;
    $this->i32WithCustomDefault = null;
    $this->mapMap = null;
    $this->listMap = null;
    $this->optMapVal = null;
    $this->optSetVal = null;
    $this->optListVal = null;
    $this->optLateStructVal = null;
    $this->optStructVal = null;
    $this->optEnumVal = null;
    $this->optBinaryVal = null;
    $this->optStringVal = null;
    $this->optDoubleVal = null;
    $this->optFloatVal = null;
    $this->optI64Val = null;
    $this->optI32Val = null;
    $this->optI16Val = null;
    $this->optByteVal = null;
    $this->optBoolVal = null;
    $this->lateStructVal = null;
    $this->unionVal = null;
    $this->structVal = null;
    $this->enumVal = null;
    $this->binaryVal = null;
    $this->stringVal = null;
    $this->doubleVal = null;
    $this->floatVal = null;
    $this->i64Val = null;
    $this->i32Val = null;
    $this->i16Val = null;
    $this->byteVal = null;
    $this->boolVal = null;
    $this->structWithFieldCustomDefault = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructFieldPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -32,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataWithCustomDefaultPatch",
                    )
                  ),
                )
              ),
              "name" => "structWithCustomDefault",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -31,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I32Patch",
                    )
                  ),
                )
              ),
              "name" => "i32WithCustomDefault",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -30,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructField30Patch",
                    )
                  ),
                )
              ),
              "name" => "mapMap",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -29,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructField29Patch",
                    )
                  ),
                )
              ),
              "name" => "listMap",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -28,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructField28Patch",
                    )
                  ),
                )
              ),
              "name" => "optMapVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -27,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructField27Patch",
                    )
                  ),
                )
              ),
              "name" => "optSetVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -26,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructField26Patch",
                    )
                  ),
                )
              ),
              "name" => "optListVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -25,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.LateDefStructPatch",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.LateDefStructPatch",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optLateStructVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -24,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataPatch",
                    )
                  ),
                )
              ),
              "name" => "optStructVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -23,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructField23Patch",
                    )
                  ),
                )
              ),
              "name" => "optEnumVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -22,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.BinaryPatch",
                    )
                  ),
                )
              ),
              "name" => "optBinaryVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -21,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.StringPatch",
                    )
                  ),
                )
              ),
              "name" => "optStringVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -20,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.DoublePatch",
                    )
                  ),
                )
              ),
              "name" => "optDoubleVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -19,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.FloatPatch",
                    )
                  ),
                )
              ),
              "name" => "optFloatVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -18,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I64Patch",
                    )
                  ),
                )
              ),
              "name" => "optI64Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -17,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I32Patch",
                    )
                  ),
                )
              ),
              "name" => "optI32Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -16,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I16Patch",
                    )
                  ),
                )
              ),
              "name" => "optI16Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -15,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.BytePatch",
                    )
                  ),
                )
              ),
              "name" => "optByteVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -14,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.BoolPatch",
                    )
                  ),
                )
              ),
              "name" => "optBoolVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -13,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.LateDefStructPatch",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.LateDefStructPatch",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "lateStructVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -12,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyUnionPatch",
                    )
                  ),
                )
              ),
              "name" => "unionVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -11,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataPatch",
                    )
                  ),
                )
              ),
              "name" => "structVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -10,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyStructField10Patch",
                    )
                  ),
                )
              ),
              "name" => "enumVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.BinaryPatch",
                    )
                  ),
                )
              ),
              "name" => "binaryVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -8,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.StringPatch",
                    )
                  ),
                )
              ),
              "name" => "stringVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.DoublePatch",
                    )
                  ),
                )
              ),
              "name" => "doubleVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.FloatPatch",
                    )
                  ),
                )
              ),
              "name" => "floatVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I64Patch",
                    )
                  ),
                )
              ),
              "name" => "i64Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -4,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I32Patch",
                    )
                  ),
                )
              ),
              "name" => "i32Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.I16Patch",
                    )
                  ),
                )
              ),
              "name" => "i16Val",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.BytePatch",
                    )
                  ),
                )
              ),
              "name" => "byteVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "patch.BoolPatch",
                    )
                  ),
                )
              ),
              "name" => "boolVal",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataPatch",
                    )
                  ),
                )
              ),
              "name" => "structWithFieldCustomDefault",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::MyStructFieldPatchStruct>",
            "underlyingName" => "MyStructFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'structWithCustomDefault' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::MyDataWithCustomDefaultPatchStruct>",
                "underlyingName" => "MyDataWithCustomDefaultPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'i32WithCustomDefault' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I32PatchStruct>",
                "underlyingName" => "I32PatchStruct",
              )
            ),
          ],
        ),
        'mapMap' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::MapPatchAdapter<::test::fixtures::patch::MyStructField30PatchStruct>",
                "underlyingName" => "MyStructField30PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'listMap' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::ListPatchAdapter<::test::fixtures::patch::MyStructField29PatchStruct>",
                "underlyingName" => "MyStructField29PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'optMapVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::MapPatchAdapter<::test::fixtures::patch::MyStructField28PatchStruct>",
                "underlyingName" => "MyStructField28PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'optSetVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::SetPatchAdapter<::test::fixtures::patch::MyStructField27PatchStruct>",
                "underlyingName" => "MyStructField27PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'optListVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::ListPatchAdapter<::test::fixtures::patch::MyStructField26PatchStruct>",
                "underlyingName" => "MyStructField26PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'optLateStructVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::LateDefStructPatchStruct>",
                "underlyingName" => "LateDefStructPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'optStructVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::MyDataPatchStruct>",
                "underlyingName" => "MyDataPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'optEnumVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::MyStructField23PatchStruct>",
                "underlyingName" => "MyStructField23PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'optBinaryVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::BinaryPatchAdapter<::apache::thrift::op::BinaryPatchStruct>",
                "underlyingName" => "BinaryPatchStruct",
              )
            ),
          ],
        ),
        'optStringVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StringPatchAdapter<::apache::thrift::op::StringPatchStruct>",
                "underlyingName" => "StringPatchStruct",
              )
            ),
          ],
        ),
        'optDoubleVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::DoublePatchStruct>",
                "underlyingName" => "DoublePatchStruct",
              )
            ),
          ],
        ),
        'optFloatVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::FloatPatchStruct>",
                "underlyingName" => "FloatPatchStruct",
              )
            ),
          ],
        ),
        'optI64Val' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I64PatchStruct>",
                "underlyingName" => "I64PatchStruct",
              )
            ),
          ],
        ),
        'optI32Val' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I32PatchStruct>",
                "underlyingName" => "I32PatchStruct",
              )
            ),
          ],
        ),
        'optI16Val' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I16PatchStruct>",
                "underlyingName" => "I16PatchStruct",
              )
            ),
          ],
        ),
        'optByteVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::BytePatchStruct>",
                "underlyingName" => "BytePatchStruct",
              )
            ),
          ],
        ),
        'optBoolVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::BoolPatchAdapter<::apache::thrift::op::BoolPatchStruct>",
                "underlyingName" => "BoolPatchStruct",
              )
            ),
          ],
        ),
        'lateStructVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::LateDefStructPatchStruct>",
                "underlyingName" => "LateDefStructPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'unionVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::UnionPatchAdapter<::test::fixtures::patch::MyUnionPatchStruct>",
                "underlyingName" => "MyUnionPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'structVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::MyDataPatchStruct>",
                "underlyingName" => "MyDataPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'enumVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::MyStructField10PatchStruct>",
                "underlyingName" => "MyStructField10PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'binaryVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::BinaryPatchAdapter<::apache::thrift::op::BinaryPatchStruct>",
                "underlyingName" => "BinaryPatchStruct",
              )
            ),
          ],
        ),
        'stringVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StringPatchAdapter<::apache::thrift::op::StringPatchStruct>",
                "underlyingName" => "StringPatchStruct",
              )
            ),
          ],
        ),
        'doubleVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::DoublePatchStruct>",
                "underlyingName" => "DoublePatchStruct",
              )
            ),
          ],
        ),
        'floatVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::FloatPatchStruct>",
                "underlyingName" => "FloatPatchStruct",
              )
            ),
          ],
        ),
        'i64Val' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I64PatchStruct>",
                "underlyingName" => "I64PatchStruct",
              )
            ),
          ],
        ),
        'i32Val' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I32PatchStruct>",
                "underlyingName" => "I32PatchStruct",
              )
            ),
          ],
        ),
        'i16Val' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::I16PatchStruct>",
                "underlyingName" => "I16PatchStruct",
              )
            ),
          ],
        ),
        'byteVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::NumberPatchAdapter<::apache::thrift::op::BytePatchStruct>",
                "underlyingName" => "BytePatchStruct",
              )
            ),
          ],
        ),
        'boolVal' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::BoolPatchAdapter<::apache::thrift::op::BoolPatchStruct>",
                "underlyingName" => "BoolPatchStruct",
              )
            ),
          ],
        ),
        'structWithFieldCustomDefault' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::MyDataPatchStruct>",
                "underlyingName" => "MyDataPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'structWithCustomDefault') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataWithCustomDefaultPatch>($parsed['structWithCustomDefault']));
      $_tmp1 = \test\fixtures\patch\MyDataWithCustomDefaultPatch::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->structWithCustomDefault = $_tmp1;
    }
    if (idx($parsed, 'i32WithCustomDefault') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I32Patch>($parsed['i32WithCustomDefault']));
      $_tmp3 = \facebook\thrift\op\I32Patch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->i32WithCustomDefault = $_tmp3;
    }
    if (idx($parsed, 'mapMap') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructField30Patch>($parsed['mapMap']));
      $_tmp5 = \test\fixtures\patch\MyStructField30Patch::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->mapMap = $_tmp5;
    }
    if (idx($parsed, 'listMap') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructField29Patch>($parsed['listMap']));
      $_tmp7 = \test\fixtures\patch\MyStructField29Patch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->listMap = $_tmp7;
    }
    if (idx($parsed, 'optMapVal') !== null) {
      $_tmp8 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructField28Patch>($parsed['optMapVal']));
      $_tmp9 = \test\fixtures\patch\MyStructField28Patch::withDefaultValues();
      $_tmp9->readFromJson($_tmp8);
      $this->optMapVal = $_tmp9;
    }
    if (idx($parsed, 'optSetVal') !== null) {
      $_tmp10 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructField27Patch>($parsed['optSetVal']));
      $_tmp11 = \test\fixtures\patch\MyStructField27Patch::withDefaultValues();
      $_tmp11->readFromJson($_tmp10);
      $this->optSetVal = $_tmp11;
    }
    if (idx($parsed, 'optListVal') !== null) {
      $_tmp12 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructField26Patch>($parsed['optListVal']));
      $_tmp13 = \test\fixtures\patch\MyStructField26Patch::withDefaultValues();
      $_tmp13->readFromJson($_tmp12);
      $this->optListVal = $_tmp13;
    }
    if (idx($parsed, 'optLateStructVal') !== null) {
      $_tmp14 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStructPatch>($parsed['optLateStructVal']));
      $_tmp15 = \test\fixtures\patch\LateDefStructPatch::withDefaultValues();
      $_tmp15->readFromJson($_tmp14);
      $this->optLateStructVal = $_tmp15;
    }
    if (idx($parsed, 'optStructVal') !== null) {
      $_tmp16 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataPatch>($parsed['optStructVal']));
      $_tmp17 = \test\fixtures\patch\MyDataPatch::withDefaultValues();
      $_tmp17->readFromJson($_tmp16);
      $this->optStructVal = $_tmp17;
    }
    if (idx($parsed, 'optEnumVal') !== null) {
      $_tmp18 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructField23Patch>($parsed['optEnumVal']));
      $_tmp19 = \test\fixtures\patch\MyStructField23Patch::withDefaultValues();
      $_tmp19->readFromJson($_tmp18);
      $this->optEnumVal = $_tmp19;
    }
    if (idx($parsed, 'optBinaryVal') !== null) {
      $_tmp20 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\BinaryPatch>($parsed['optBinaryVal']));
      $_tmp21 = \facebook\thrift\op\BinaryPatch::withDefaultValues();
      $_tmp21->readFromJson($_tmp20);
      $this->optBinaryVal = $_tmp21;
    }
    if (idx($parsed, 'optStringVal') !== null) {
      $_tmp22 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\StringPatch>($parsed['optStringVal']));
      $_tmp23 = \facebook\thrift\op\StringPatch::withDefaultValues();
      $_tmp23->readFromJson($_tmp22);
      $this->optStringVal = $_tmp23;
    }
    if (idx($parsed, 'optDoubleVal') !== null) {
      $_tmp24 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\DoublePatch>($parsed['optDoubleVal']));
      $_tmp25 = \facebook\thrift\op\DoublePatch::withDefaultValues();
      $_tmp25->readFromJson($_tmp24);
      $this->optDoubleVal = $_tmp25;
    }
    if (idx($parsed, 'optFloatVal') !== null) {
      $_tmp26 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\FloatPatch>($parsed['optFloatVal']));
      $_tmp27 = \facebook\thrift\op\FloatPatch::withDefaultValues();
      $_tmp27->readFromJson($_tmp26);
      $this->optFloatVal = $_tmp27;
    }
    if (idx($parsed, 'optI64Val') !== null) {
      $_tmp28 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I64Patch>($parsed['optI64Val']));
      $_tmp29 = \facebook\thrift\op\I64Patch::withDefaultValues();
      $_tmp29->readFromJson($_tmp28);
      $this->optI64Val = $_tmp29;
    }
    if (idx($parsed, 'optI32Val') !== null) {
      $_tmp30 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I32Patch>($parsed['optI32Val']));
      $_tmp31 = \facebook\thrift\op\I32Patch::withDefaultValues();
      $_tmp31->readFromJson($_tmp30);
      $this->optI32Val = $_tmp31;
    }
    if (idx($parsed, 'optI16Val') !== null) {
      $_tmp32 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I16Patch>($parsed['optI16Val']));
      $_tmp33 = \facebook\thrift\op\I16Patch::withDefaultValues();
      $_tmp33->readFromJson($_tmp32);
      $this->optI16Val = $_tmp33;
    }
    if (idx($parsed, 'optByteVal') !== null) {
      $_tmp34 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\BytePatch>($parsed['optByteVal']));
      $_tmp35 = \facebook\thrift\op\BytePatch::withDefaultValues();
      $_tmp35->readFromJson($_tmp34);
      $this->optByteVal = $_tmp35;
    }
    if (idx($parsed, 'optBoolVal') !== null) {
      $_tmp36 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\BoolPatch>($parsed['optBoolVal']));
      $_tmp37 = \facebook\thrift\op\BoolPatch::withDefaultValues();
      $_tmp37->readFromJson($_tmp36);
      $this->optBoolVal = $_tmp37;
    }
    if (idx($parsed, 'lateStructVal') !== null) {
      $_tmp38 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStructPatch>($parsed['lateStructVal']));
      $_tmp39 = \test\fixtures\patch\LateDefStructPatch::withDefaultValues();
      $_tmp39->readFromJson($_tmp38);
      $this->lateStructVal = $_tmp39;
    }
    if (idx($parsed, 'unionVal') !== null) {
      $_tmp40 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyUnionPatch>($parsed['unionVal']));
      $_tmp41 = \test\fixtures\patch\MyUnionPatch::withDefaultValues();
      $_tmp41->readFromJson($_tmp40);
      $this->unionVal = $_tmp41;
    }
    if (idx($parsed, 'structVal') !== null) {
      $_tmp42 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataPatch>($parsed['structVal']));
      $_tmp43 = \test\fixtures\patch\MyDataPatch::withDefaultValues();
      $_tmp43->readFromJson($_tmp42);
      $this->structVal = $_tmp43;
    }
    if (idx($parsed, 'enumVal') !== null) {
      $_tmp44 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyStructField10Patch>($parsed['enumVal']));
      $_tmp45 = \test\fixtures\patch\MyStructField10Patch::withDefaultValues();
      $_tmp45->readFromJson($_tmp44);
      $this->enumVal = $_tmp45;
    }
    if (idx($parsed, 'binaryVal') !== null) {
      $_tmp46 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\BinaryPatch>($parsed['binaryVal']));
      $_tmp47 = \facebook\thrift\op\BinaryPatch::withDefaultValues();
      $_tmp47->readFromJson($_tmp46);
      $this->binaryVal = $_tmp47;
    }
    if (idx($parsed, 'stringVal') !== null) {
      $_tmp48 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\StringPatch>($parsed['stringVal']));
      $_tmp49 = \facebook\thrift\op\StringPatch::withDefaultValues();
      $_tmp49->readFromJson($_tmp48);
      $this->stringVal = $_tmp49;
    }
    if (idx($parsed, 'doubleVal') !== null) {
      $_tmp50 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\DoublePatch>($parsed['doubleVal']));
      $_tmp51 = \facebook\thrift\op\DoublePatch::withDefaultValues();
      $_tmp51->readFromJson($_tmp50);
      $this->doubleVal = $_tmp51;
    }
    if (idx($parsed, 'floatVal') !== null) {
      $_tmp52 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\FloatPatch>($parsed['floatVal']));
      $_tmp53 = \facebook\thrift\op\FloatPatch::withDefaultValues();
      $_tmp53->readFromJson($_tmp52);
      $this->floatVal = $_tmp53;
    }
    if (idx($parsed, 'i64Val') !== null) {
      $_tmp54 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I64Patch>($parsed['i64Val']));
      $_tmp55 = \facebook\thrift\op\I64Patch::withDefaultValues();
      $_tmp55->readFromJson($_tmp54);
      $this->i64Val = $_tmp55;
    }
    if (idx($parsed, 'i32Val') !== null) {
      $_tmp56 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I32Patch>($parsed['i32Val']));
      $_tmp57 = \facebook\thrift\op\I32Patch::withDefaultValues();
      $_tmp57->readFromJson($_tmp56);
      $this->i32Val = $_tmp57;
    }
    if (idx($parsed, 'i16Val') !== null) {
      $_tmp58 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\I16Patch>($parsed['i16Val']));
      $_tmp59 = \facebook\thrift\op\I16Patch::withDefaultValues();
      $_tmp59->readFromJson($_tmp58);
      $this->i16Val = $_tmp59;
    }
    if (idx($parsed, 'byteVal') !== null) {
      $_tmp60 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\BytePatch>($parsed['byteVal']));
      $_tmp61 = \facebook\thrift\op\BytePatch::withDefaultValues();
      $_tmp61->readFromJson($_tmp60);
      $this->byteVal = $_tmp61;
    }
    if (idx($parsed, 'boolVal') !== null) {
      $_tmp62 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \facebook\thrift\op\BoolPatch>($parsed['boolVal']));
      $_tmp63 = \facebook\thrift\op\BoolPatch::withDefaultValues();
      $_tmp63->readFromJson($_tmp62);
      $this->boolVal = $_tmp63;
    }
    if (idx($parsed, 'structWithFieldCustomDefault') !== null) {
      $_tmp64 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataPatch>($parsed['structWithFieldCustomDefault']));
      $_tmp65 = \test\fixtures\patch\MyDataPatch::withDefaultValues();
      $_tmp65->readFromJson($_tmp64);
      $this->structWithFieldCustomDefault = $_tmp65;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStructEnsureStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/MyStructEnsureStruct'))>>
class MyStructEnsureStruct implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -32 => shape(
      'var' => 'structWithCustomDefault',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyDataWithCustomDefault::class,
    ),
    -31 => shape(
      'var' => 'i32WithCustomDefault',
      'type' => \TType::I32,
    ),
    -30 => shape(
      'var' => 'mapMap',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::MAP,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    -29 => shape(
      'var' => 'listMap',
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    -28 => shape(
      'var' => 'optMapVal',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRING,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    -27 => shape(
      'var' => 'optSetVal',
      'type' => \TType::SET,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    -26 => shape(
      'var' => 'optListVal',
      'type' => \TType::LST,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
    -25 => shape(
      'var' => 'optLateStructVal',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStruct::class,
    ),
    -24 => shape(
      'var' => 'optStructVal',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyData::class,
    ),
    -23 => shape(
      'var' => 'optEnumVal',
      'type' => \TType::I32,
      'enum' => \test\fixtures\patch\MyEnum::class,
    ),
    -22 => shape(
      'var' => 'optBinaryVal',
      'type' => \TType::STRING,
      'is_binary' => true,
    ),
    -21 => shape(
      'var' => 'optStringVal',
      'type' => \TType::STRING,
    ),
    -20 => shape(
      'var' => 'optDoubleVal',
      'type' => \TType::DOUBLE,
    ),
    -19 => shape(
      'var' => 'optFloatVal',
      'type' => \TType::FLOAT,
    ),
    -18 => shape(
      'var' => 'optI64Val',
      'type' => \TType::I64,
    ),
    -17 => shape(
      'var' => 'optI32Val',
      'type' => \TType::I32,
    ),
    -16 => shape(
      'var' => 'optI16Val',
      'type' => \TType::I16,
    ),
    -15 => shape(
      'var' => 'optByteVal',
      'type' => \TType::BYTE,
    ),
    -14 => shape(
      'var' => 'optBoolVal',
      'type' => \TType::BOOL,
    ),
    -13 => shape(
      'var' => 'lateStructVal',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStruct::class,
    ),
    -12 => shape(
      'var' => 'unionVal',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyUnion::class,
    ),
    -11 => shape(
      'var' => 'structVal',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyData::class,
    ),
    -10 => shape(
      'var' => 'enumVal',
      'type' => \TType::I32,
      'enum' => \test\fixtures\patch\MyEnum::class,
    ),
    -9 => shape(
      'var' => 'binaryVal',
      'type' => \TType::STRING,
      'is_binary' => true,
    ),
    -8 => shape(
      'var' => 'stringVal',
      'type' => \TType::STRING,
    ),
    -7 => shape(
      'var' => 'doubleVal',
      'type' => \TType::DOUBLE,
    ),
    -6 => shape(
      'var' => 'floatVal',
      'type' => \TType::FLOAT,
    ),
    -5 => shape(
      'var' => 'i64Val',
      'type' => \TType::I64,
    ),
    -4 => shape(
      'var' => 'i32Val',
      'type' => \TType::I32,
    ),
    -3 => shape(
      'var' => 'i16Val',
      'type' => \TType::I16,
    ),
    -2 => shape(
      'var' => 'byteVal',
      'type' => \TType::BYTE,
    ),
    -1 => shape(
      'var' => 'boolVal',
      'type' => \TType::BOOL,
    ),
    1 => shape(
      'var' => 'structWithFieldCustomDefault',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\MyData::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'structWithCustomDefault' => -32,
    'i32WithCustomDefault' => -31,
    'mapMap' => -30,
    'listMap' => -29,
    'optMapVal' => -28,
    'optSetVal' => -27,
    'optListVal' => -26,
    'optLateStructVal' => -25,
    'optStructVal' => -24,
    'optEnumVal' => -23,
    'optBinaryVal' => -22,
    'optStringVal' => -21,
    'optDoubleVal' => -20,
    'optFloatVal' => -19,
    'optI64Val' => -18,
    'optI32Val' => -17,
    'optI16Val' => -16,
    'optByteVal' => -15,
    'optBoolVal' => -14,
    'lateStructVal' => -13,
    'unionVal' => -12,
    'structVal' => -11,
    'enumVal' => -10,
    'binaryVal' => -9,
    'stringVal' => -8,
    'doubleVal' => -7,
    'floatVal' => -6,
    'i64Val' => -5,
    'i32Val' => -4,
    'i16Val' => -3,
    'byteVal' => -2,
    'boolVal' => -1,
    'structWithFieldCustomDefault' => 1,
  ];

  const type TConstructorShape = shape(
    ?'structWithCustomDefault' => ?\test\fixtures\patch\MyDataWithCustomDefault,
    ?'i32WithCustomDefault' => ?int,
    ?'mapMap' => ?Map<string, Map<string, int>>,
    ?'listMap' => ?Vector<Map<string, int>>,
    ?'optMapVal' => ?Map<string, string>,
    ?'optSetVal' => ?Set<string>,
    ?'optListVal' => ?Vector<int>,
    ?'optLateStructVal' => ?\test\fixtures\patch\LateDefStruct,
    ?'optStructVal' => ?\test\fixtures\patch\MyData,
    ?'optEnumVal' => ?\test\fixtures\patch\MyEnum,
    ?'optBinaryVal' => ?string,
    ?'optStringVal' => ?string,
    ?'optDoubleVal' => ?float,
    ?'optFloatVal' => ?float,
    ?'optI64Val' => ?int,
    ?'optI32Val' => ?int,
    ?'optI16Val' => ?int,
    ?'optByteVal' => ?int,
    ?'optBoolVal' => ?bool,
    ?'lateStructVal' => ?\test\fixtures\patch\LateDefStruct,
    ?'unionVal' => ?\test\fixtures\patch\MyUnion,
    ?'structVal' => ?\test\fixtures\patch\MyData,
    ?'enumVal' => ?\test\fixtures\patch\MyEnum,
    ?'binaryVal' => ?string,
    ?'stringVal' => ?string,
    ?'doubleVal' => ?float,
    ?'floatVal' => ?float,
    ?'i64Val' => ?int,
    ?'i32Val' => ?int,
    ?'i16Val' => ?int,
    ?'byteVal' => ?int,
    ?'boolVal' => ?bool,
    ?'structWithFieldCustomDefault' => ?\test\fixtures\patch\MyData,
  );

  const int STRUCTURAL_ID = 8458031364624826074;
  /**
   * Original thrift field:-
   * -32: module.MyDataWithCustomDefault structWithCustomDefault
   */
  public ?\test\fixtures\patch\MyDataWithCustomDefault $structWithCustomDefault;
  /**
   * Original thrift field:-
   * -31: i32 i32WithCustomDefault
   */
  public ?int $i32WithCustomDefault;
  /**
   * Original thrift field:-
   * -30: map<string, map<string, i32>> mapMap
   */
  public ?Map<string, Map<string, int>> $mapMap;
  /**
   * Original thrift field:-
   * -29: list<map<string, i32>> listMap
   */
  public ?Vector<Map<string, int>> $listMap;
  /**
   * Original thrift field:-
   * -28: map<string, string> optMapVal
   */
  public ?Map<string, string> $optMapVal;
  /**
   * Original thrift field:-
   * -27: set<string> optSetVal
   */
  public ?Set<string> $optSetVal;
  /**
   * Original thrift field:-
   * -26: list<i16> optListVal
   */
  public ?Vector<int> $optListVal;
  /**
   * Original thrift field:-
   * -25: module.LateDefStruct optLateStructVal
   */
  public ?\test\fixtures\patch\LateDefStruct $optLateStructVal;
  /**
   * Original thrift field:-
   * -24: module.MyData optStructVal
   */
  public ?\test\fixtures\patch\MyData $optStructVal;
  /**
   * Original thrift field:-
   * -23: module.MyEnum optEnumVal
   */
  public ?\test\fixtures\patch\MyEnum $optEnumVal;
  /**
   * Original thrift field:-
   * -22: binary optBinaryVal
   */
  public ?string $optBinaryVal;
  /**
   * Original thrift field:-
   * -21: string optStringVal
   */
  public ?string $optStringVal;
  /**
   * Original thrift field:-
   * -20: double optDoubleVal
   */
  public ?float $optDoubleVal;
  /**
   * Original thrift field:-
   * -19: float optFloatVal
   */
  public ?float $optFloatVal;
  /**
   * Original thrift field:-
   * -18: i64 optI64Val
   */
  public ?int $optI64Val;
  /**
   * Original thrift field:-
   * -17: i32 optI32Val
   */
  public ?int $optI32Val;
  /**
   * Original thrift field:-
   * -16: i16 optI16Val
   */
  public ?int $optI16Val;
  /**
   * Original thrift field:-
   * -15: byte optByteVal
   */
  public ?int $optByteVal;
  /**
   * Original thrift field:-
   * -14: bool optBoolVal
   */
  public ?bool $optBoolVal;
  /**
   * Original thrift field:-
   * -13: module.LateDefStruct lateStructVal
   */
  public ?\test\fixtures\patch\LateDefStruct $lateStructVal;
  /**
   * Original thrift field:-
   * -12: module.MyUnion unionVal
   */
  public ?\test\fixtures\patch\MyUnion $unionVal;
  /**
   * Original thrift field:-
   * -11: module.MyData structVal
   */
  public ?\test\fixtures\patch\MyData $structVal;
  /**
   * Original thrift field:-
   * -10: module.MyEnum enumVal
   */
  public ?\test\fixtures\patch\MyEnum $enumVal;
  /**
   * Original thrift field:-
   * -9: binary binaryVal
   */
  public ?string $binaryVal;
  /**
   * Original thrift field:-
   * -8: string stringVal
   */
  public ?string $stringVal;
  /**
   * Original thrift field:-
   * -7: double doubleVal
   */
  public ?float $doubleVal;
  /**
   * Original thrift field:-
   * -6: float floatVal
   */
  public ?float $floatVal;
  /**
   * Original thrift field:-
   * -5: i64 i64Val
   */
  public ?int $i64Val;
  /**
   * Original thrift field:-
   * -4: i32 i32Val
   */
  public ?int $i32Val;
  /**
   * Original thrift field:-
   * -3: i16 i16Val
   */
  public ?int $i16Val;
  /**
   * Original thrift field:-
   * -2: byte byteVal
   */
  public ?int $byteVal;
  /**
   * Original thrift field:-
   * -1: bool boolVal
   */
  public ?bool $boolVal;
  /**
   * Original thrift field:-
   * 1: module.MyData structWithFieldCustomDefault
   */
  public ?\test\fixtures\patch\MyData $structWithFieldCustomDefault;

  public function __construct(?\test\fixtures\patch\MyDataWithCustomDefault $structWithCustomDefault = null, ?int $i32WithCustomDefault = null, ?Map<string, Map<string, int>> $mapMap = null, ?Vector<Map<string, int>> $listMap = null, ?Map<string, string> $optMapVal = null, ?Set<string> $optSetVal = null, ?Vector<int> $optListVal = null, ?\test\fixtures\patch\LateDefStruct $optLateStructVal = null, ?\test\fixtures\patch\MyData $optStructVal = null, ?\test\fixtures\patch\MyEnum $optEnumVal = null, ?string $optBinaryVal = null, ?string $optStringVal = null, ?float $optDoubleVal = null, ?float $optFloatVal = null, ?int $optI64Val = null, ?int $optI32Val = null, ?int $optI16Val = null, ?int $optByteVal = null, ?bool $optBoolVal = null, ?\test\fixtures\patch\LateDefStruct $lateStructVal = null, ?\test\fixtures\patch\MyUnion $unionVal = null, ?\test\fixtures\patch\MyData $structVal = null, ?\test\fixtures\patch\MyEnum $enumVal = null, ?string $binaryVal = null, ?string $stringVal = null, ?float $doubleVal = null, ?float $floatVal = null, ?int $i64Val = null, ?int $i32Val = null, ?int $i16Val = null, ?int $byteVal = null, ?bool $boolVal = null, ?\test\fixtures\patch\MyData $structWithFieldCustomDefault = null)[] {
    $this->structWithCustomDefault = $structWithCustomDefault;
    $this->i32WithCustomDefault = $i32WithCustomDefault;
    $this->mapMap = $mapMap;
    $this->listMap = $listMap;
    $this->optMapVal = $optMapVal;
    $this->optSetVal = $optSetVal;
    $this->optListVal = $optListVal;
    $this->optLateStructVal = $optLateStructVal;
    $this->optStructVal = $optStructVal;
    $this->optEnumVal = $optEnumVal;
    $this->optBinaryVal = $optBinaryVal;
    $this->optStringVal = $optStringVal;
    $this->optDoubleVal = $optDoubleVal;
    $this->optFloatVal = $optFloatVal;
    $this->optI64Val = $optI64Val;
    $this->optI32Val = $optI32Val;
    $this->optI16Val = $optI16Val;
    $this->optByteVal = $optByteVal;
    $this->optBoolVal = $optBoolVal;
    $this->lateStructVal = $lateStructVal;
    $this->unionVal = $unionVal;
    $this->structVal = $structVal;
    $this->enumVal = $enumVal;
    $this->binaryVal = $binaryVal;
    $this->stringVal = $stringVal;
    $this->doubleVal = $doubleVal;
    $this->floatVal = $floatVal;
    $this->i64Val = $i64Val;
    $this->i32Val = $i32Val;
    $this->i16Val = $i16Val;
    $this->byteVal = $byteVal;
    $this->boolVal = $boolVal;
    $this->structWithFieldCustomDefault = $structWithFieldCustomDefault;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'structWithCustomDefault'),
      Shapes::idx($shape, 'i32WithCustomDefault'),
      Shapes::idx($shape, 'mapMap'),
      Shapes::idx($shape, 'listMap'),
      Shapes::idx($shape, 'optMapVal'),
      Shapes::idx($shape, 'optSetVal'),
      Shapes::idx($shape, 'optListVal'),
      Shapes::idx($shape, 'optLateStructVal'),
      Shapes::idx($shape, 'optStructVal'),
      Shapes::idx($shape, 'optEnumVal'),
      Shapes::idx($shape, 'optBinaryVal'),
      Shapes::idx($shape, 'optStringVal'),
      Shapes::idx($shape, 'optDoubleVal'),
      Shapes::idx($shape, 'optFloatVal'),
      Shapes::idx($shape, 'optI64Val'),
      Shapes::idx($shape, 'optI32Val'),
      Shapes::idx($shape, 'optI16Val'),
      Shapes::idx($shape, 'optByteVal'),
      Shapes::idx($shape, 'optBoolVal'),
      Shapes::idx($shape, 'lateStructVal'),
      Shapes::idx($shape, 'unionVal'),
      Shapes::idx($shape, 'structVal'),
      Shapes::idx($shape, 'enumVal'),
      Shapes::idx($shape, 'binaryVal'),
      Shapes::idx($shape, 'stringVal'),
      Shapes::idx($shape, 'doubleVal'),
      Shapes::idx($shape, 'floatVal'),
      Shapes::idx($shape, 'i64Val'),
      Shapes::idx($shape, 'i32Val'),
      Shapes::idx($shape, 'i16Val'),
      Shapes::idx($shape, 'byteVal'),
      Shapes::idx($shape, 'boolVal'),
      Shapes::idx($shape, 'structWithFieldCustomDefault'),
    );
  }

  public function getName()[]: string {
    return 'MyStructEnsureStruct';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStructEnsureStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -32,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyDataWithCustomDefault",
                    )
                  ),
                )
              ),
              "name" => "structWithCustomDefault",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -31,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32WithCustomDefault",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -30,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "mapMap",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -29,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => \tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "listMap",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -28,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optMapVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -27,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optSetVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -26,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => \tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optListVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -25,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.LateDefStruct",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.LateDefStruct",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optLateStructVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -24,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyData",
                    )
                  ),
                )
              ),
              "name" => "optStructVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -23,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum",
                    )
                  ),
                )
              ),
              "name" => "optEnumVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -22,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE,
                )
              ),
              "name" => "optBinaryVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -21,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "optStringVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -20,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE,
                )
              ),
              "name" => "optDoubleVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -19,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_FLOAT_TYPE,
                )
              ),
              "name" => "optFloatVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -18,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                )
              ),
              "name" => "optI64Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -17,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "optI32Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -16,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                )
              ),
              "name" => "optI16Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -15,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BYTE_TYPE,
                )
              ),
              "name" => "optByteVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -14,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "optBoolVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -13,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.LateDefStruct",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.LateDefStruct",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "lateStructVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -12,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyUnion",
                    )
                  ),
                )
              ),
              "name" => "unionVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -11,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyData",
                    )
                  ),
                )
              ),
              "name" => "structVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -10,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum",
                    )
                  ),
                )
              ),
              "name" => "enumVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -9,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE,
                )
              ),
              "name" => "binaryVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -8,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "stringVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE,
                )
              ),
              "name" => "doubleVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_FLOAT_TYPE,
                )
              ),
              "name" => "floatVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                )
              ),
              "name" => "i64Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -4,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                )
              ),
              "name" => "i16Val",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BYTE_TYPE,
                )
              ),
              "name" => "byteVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "boolVal",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.MyData",
                    )
                  ),
                )
              ),
              "name" => "structWithFieldCustomDefault",
              "is_optional" => true,
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'structWithCustomDefault') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyDataWithCustomDefault>($parsed['structWithCustomDefault']));
      $_tmp1 = \test\fixtures\patch\MyDataWithCustomDefault::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->structWithCustomDefault = $_tmp1;
    }
    if (idx($parsed, 'i32WithCustomDefault') !== null) {
      $_tmp2 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i32WithCustomDefault']);
      if ($_tmp2 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->i32WithCustomDefault = (int)$_tmp2;
      }
    }
    if (idx($parsed, 'mapMap') !== null) {
      $_json6 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, Map<string, int>>>($parsed['mapMap']);
      $_container7 = Map {};
      foreach($_json6 as $_key4 => $_value5) {
        $_value8 = Map {};
        $_json12 = $_value5;
        $_container13 = Map {};
        foreach($_json12 as $_key10 => $_value11) {
          $_value14 = 0;
          $_tmp15 = (int)$_value11;
          if ($_tmp15 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value14 = (int)$_tmp15;
          }
          $_container13[$_key10] = $_value14;
        }
        $_value8 = $_container13;
        $_container7[$_key4] = $_value8;
      }
      $this->mapMap = $_container7;
    }
    if (idx($parsed, 'listMap') !== null) {
      $_json19 = HH\FIXME\UNSAFE_CAST<mixed, Vector<Map<string, int>>>($parsed['listMap']);
      $_container20 = Vector {};
      foreach($_json19 as $_key17 => $_value18) {
        $_elem21 = Map {};
        $_json25 = $_value18;
        $_container26 = Map {};
        foreach($_json25 as $_key23 => $_value24) {
          $_value27 = 0;
          $_tmp28 = (int)$_value24;
          if ($_tmp28 > 0x7fffffff) {
            throw new \TProtocolException("number exceeds limit in field");
          } else {
            $_value27 = (int)$_tmp28;
          }
          $_container26[$_key23] = $_value27;
        }
        $_elem21 = $_container26;
        $_container20 []= $_elem21;
      }
      $this->listMap = $_container20;
    }
    if (idx($parsed, 'optMapVal') !== null) {
      $_json32 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, string>>($parsed['optMapVal']);
      $_container33 = Map {};
      foreach($_json32 as $_key30 => $_value31) {
        $_value34 = '';
        $_value34 = $_value31;
        $_container33[$_key30] = $_value34;
      }
      $this->optMapVal = $_container33;
    }
    if (idx($parsed, 'optSetVal') !== null) {
      $_json38 = HH\FIXME\UNSAFE_CAST<mixed, Set<string>>($parsed['optSetVal']);
      $_container39 = Set {};
      foreach($_json38 as $_key36 => $_value37) {
        $_elem40 = '';
        $_elem40 = $_value37;
        $_container39->add($_elem40);
      }
      $this->optSetVal = $_container39;
    }
    if (idx($parsed, 'optListVal') !== null) {
      $_json44 = HH\FIXME\UNSAFE_CAST<mixed, Vector<int>>($parsed['optListVal']);
      $_container45 = Vector {};
      foreach($_json44 as $_key42 => $_value43) {
        $_elem46 = 0;
        $_tmp47 = (int)$_value43;
        if ($_tmp47 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem46 = (int)$_tmp47;
        }
        $_container45 []= $_elem46;
      }
      $this->optListVal = $_container45;
    }
    if (idx($parsed, 'optLateStructVal') !== null) {
      $_tmp48 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStruct>($parsed['optLateStructVal']));
      $_tmp49 = \test\fixtures\patch\LateDefStruct::withDefaultValues();
      $_tmp49->readFromJson($_tmp48);
      $this->optLateStructVal = $_tmp49;
    }
    if (idx($parsed, 'optStructVal') !== null) {
      $_tmp50 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyData>($parsed['optStructVal']));
      $_tmp51 = \test\fixtures\patch\MyData::withDefaultValues();
      $_tmp51->readFromJson($_tmp50);
      $this->optStructVal = $_tmp51;
    }
    if (idx($parsed, 'optEnumVal') !== null) {
      $this->optEnumVal = \test\fixtures\patch\MyEnum::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyEnum>($parsed['optEnumVal']));
    }
    if (idx($parsed, 'optBinaryVal') !== null) {
      $this->optBinaryVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['optBinaryVal']);
    }
    if (idx($parsed, 'optStringVal') !== null) {
      $this->optStringVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['optStringVal']);
    }
    if (idx($parsed, 'optDoubleVal') !== null) {
      $this->optDoubleVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['optDoubleVal']);
    }
    if (idx($parsed, 'optFloatVal') !== null) {
      $this->optFloatVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['optFloatVal']);
    }
    if (idx($parsed, 'optI64Val') !== null) {
      $this->optI64Val = HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optI64Val']);
    }
    if (idx($parsed, 'optI32Val') !== null) {
      $_tmp52 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optI32Val']);
      if ($_tmp52 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->optI32Val = (int)$_tmp52;
      }
    }
    if (idx($parsed, 'optI16Val') !== null) {
      $_tmp53 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optI16Val']);
      if ($_tmp53 > 0x7fff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->optI16Val = (int)$_tmp53;
      }
    }
    if (idx($parsed, 'optByteVal') !== null) {
      $_tmp54 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['optByteVal']);
      if ($_tmp54 > 0x7f) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->optByteVal = (int)$_tmp54;
      }
    }
    if (idx($parsed, 'optBoolVal') !== null) {
      $this->optBoolVal = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['optBoolVal']);
    }
    if (idx($parsed, 'lateStructVal') !== null) {
      $_tmp55 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStruct>($parsed['lateStructVal']));
      $_tmp56 = \test\fixtures\patch\LateDefStruct::withDefaultValues();
      $_tmp56->readFromJson($_tmp55);
      $this->lateStructVal = $_tmp56;
    }
    if (idx($parsed, 'unionVal') !== null) {
      $_tmp57 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyUnion>($parsed['unionVal']));
      $_tmp58 = \test\fixtures\patch\MyUnion::withDefaultValues();
      $_tmp58->readFromJson($_tmp57);
      $this->unionVal = $_tmp58;
    }
    if (idx($parsed, 'structVal') !== null) {
      $_tmp59 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyData>($parsed['structVal']));
      $_tmp60 = \test\fixtures\patch\MyData::withDefaultValues();
      $_tmp60->readFromJson($_tmp59);
      $this->structVal = $_tmp60;
    }
    if (idx($parsed, 'enumVal') !== null) {
      $this->enumVal = \test\fixtures\patch\MyEnum::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyEnum>($parsed['enumVal']));
    }
    if (idx($parsed, 'binaryVal') !== null) {
      $this->binaryVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['binaryVal']);
    }
    if (idx($parsed, 'stringVal') !== null) {
      $this->stringVal = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['stringVal']);
    }
    if (idx($parsed, 'doubleVal') !== null) {
      $this->doubleVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['doubleVal']);
    }
    if (idx($parsed, 'floatVal') !== null) {
      $this->floatVal = HH\FIXME\UNSAFE_CAST<mixed, float>($parsed['floatVal']);
    }
    if (idx($parsed, 'i64Val') !== null) {
      $this->i64Val = HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i64Val']);
    }
    if (idx($parsed, 'i32Val') !== null) {
      $_tmp61 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i32Val']);
      if ($_tmp61 > 0x7fffffff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->i32Val = (int)$_tmp61;
      }
    }
    if (idx($parsed, 'i16Val') !== null) {
      $_tmp62 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['i16Val']);
      if ($_tmp62 > 0x7fff) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->i16Val = (int)$_tmp62;
      }
    }
    if (idx($parsed, 'byteVal') !== null) {
      $_tmp63 = (int)HH\FIXME\UNSAFE_CAST<mixed, int>($parsed['byteVal']);
      if ($_tmp63 > 0x7f) {
        throw new \TProtocolException("number exceeds limit in field");
      } else {
        $this->byteVal = (int)$_tmp63;
      }
    }
    if (idx($parsed, 'boolVal') !== null) {
      $this->boolVal = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['boolVal']);
    }
    if (idx($parsed, 'structWithFieldCustomDefault') !== null) {
      $_tmp64 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\MyData>($parsed['structWithFieldCustomDefault']));
      $_tmp65 = \test\fixtures\patch\MyData::withDefaultValues();
      $_tmp65->readFromJson($_tmp64);
      $this->structWithFieldCustomDefault = $_tmp65;
    }
  }

}

/**
 * Original thrift struct:-
 * LateDefStructPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/LateDefStructPatch'))>>
class LateDefStructPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStruct::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStructFieldPatch::class,
    ),
    5 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStructEnsureStruct::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LateDefStructFieldPatch::class,
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 5,
    'patch' => 6,
    'remove' => 7,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\LateDefStruct,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\LateDefStructFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\LateDefStructEnsureStruct,
    ?'patch' => ?\test\fixtures\patch\LateDefStructFieldPatch,
    ?'remove' => ?Set<int>,
  );

  const int STRUCTURAL_ID = 4095174235818678939;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.LateDefStruct assign
   */
  public ?\test\fixtures\patch\LateDefStruct $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.LateDefStructFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\LateDefStructFieldPatch $patchPrior;
  /**
   * Initialize fields, using the given defaults. Applies third.
   *
   * Original thrift field:-
   * 5: module.LateDefStructEnsureStruct ensure
   */
  public ?\test\fixtures\patch\LateDefStructEnsureStruct $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.LateDefStructFieldPatch patch
   */
  public ?\test\fixtures\patch\LateDefStructFieldPatch $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<patch.FieldId> remove
   */
  public Set<int> $remove;

  public function __construct(?\test\fixtures\patch\LateDefStruct $assign = null, ?bool $clear = null, ?\test\fixtures\patch\LateDefStructFieldPatch $patchPrior = null, ?\test\fixtures\patch\LateDefStructEnsureStruct $ensure = null, ?\test\fixtures\patch\LateDefStructFieldPatch $patch = null, ?Set<int> $remove = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
    $this->remove = $remove ?? Set {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
    );
  }

  public function getName()[]: string {
    return 'LateDefStructPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
    $this->remove = Set {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.LateDefStructPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.LateDefStruct",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.LateDefStructFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.LateDefStructEnsureStruct",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.LateDefStructFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "patch.FieldId",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                                    shape(
                                      "name" => "id.FieldId",
                                      "underlyingType" => \tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::LateDefStructPatchStruct>",
            "underlyingName" => "LateDefStructPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::LateDefStructFieldPatchStruct>",
                "underlyingName" => "LateDefStructFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
              shape(
              )
            ),
          ],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::LateDefStructFieldPatchStruct>",
                "underlyingName" => "LateDefStructFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStruct>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\LateDefStruct::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStructFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\LateDefStructFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStructEnsureStruct>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\LateDefStructEnsureStruct::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LateDefStructFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\LateDefStructFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json11 = HH\FIXME\UNSAFE_CAST<mixed, Set<int>>($parsed['remove']);
      $_container12 = Set {};
      foreach($_json11 as $_key9 => $_value10) {
        $_elem13 = 0;
        $_tmp14 = (int)$_value10;
        if ($_tmp14 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem13 = (int)$_tmp14;
        }
        $_container12->add($_elem13);
      }
      $this->remove = $_container12;
    }
  }

}

/**
 * Original thrift struct:-
 * LateDefStructFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/LateDefStructFieldPatch'))>>
class LateDefStructFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

  public function getName()[]: string {
    return 'LateDefStructFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.LateDefStructFieldPatch",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::LateDefStructFieldPatchStruct>",
            "underlyingName" => "LateDefStructFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * Original thrift struct:-
 * LateDefStructEnsureStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/LateDefStructEnsureStruct'))>>
class LateDefStructEnsureStruct implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

  public function getName()[]: string {
    return 'LateDefStructEnsureStruct';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.LateDefStructEnsureStruct",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * Original thrift struct:-
 * RecursivePatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/RecursivePatch'))>>
class RecursivePatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\Recursive::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\RecursiveFieldPatch::class,
    ),
    5 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\RecursiveEnsureStruct::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\RecursiveFieldPatch::class,
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 5,
    'patch' => 6,
    'remove' => 7,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\Recursive,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\RecursiveFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\RecursiveEnsureStruct,
    ?'patch' => ?\test\fixtures\patch\RecursiveFieldPatch,
    ?'remove' => ?Set<int>,
  );

  const int STRUCTURAL_ID = 6057258732540886167;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.Recursive assign
   */
  public ?\test\fixtures\patch\Recursive $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.RecursiveFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\RecursiveFieldPatch $patchPrior;
  /**
   * Initialize fields, using the given defaults. Applies third.
   *
   * Original thrift field:-
   * 5: module.RecursiveEnsureStruct ensure
   */
  public ?\test\fixtures\patch\RecursiveEnsureStruct $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.RecursiveFieldPatch patch
   */
  public ?\test\fixtures\patch\RecursiveFieldPatch $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<patch.FieldId> remove
   */
  public Set<int> $remove;

  public function __construct(?\test\fixtures\patch\Recursive $assign = null, ?bool $clear = null, ?\test\fixtures\patch\RecursiveFieldPatch $patchPrior = null, ?\test\fixtures\patch\RecursiveEnsureStruct $ensure = null, ?\test\fixtures\patch\RecursiveFieldPatch $patch = null, ?Set<int> $remove = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
    $this->remove = $remove ?? Set {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
    );
  }

  public function getName()[]: string {
    return 'RecursivePatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
    $this->remove = Set {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.RecursivePatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.Recursive",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.RecursiveFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.RecursiveEnsureStruct",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.RecursiveFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "patch.FieldId",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                                    shape(
                                      "name" => "id.FieldId",
                                      "underlyingType" => \tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::RecursivePatchStruct>",
            "underlyingName" => "RecursivePatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::RecursiveFieldPatchStruct>",
                "underlyingName" => "RecursiveFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
              shape(
              )
            ),
          ],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::RecursiveFieldPatchStruct>",
                "underlyingName" => "RecursiveFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\Recursive>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\Recursive::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\RecursiveFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\RecursiveFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\RecursiveEnsureStruct>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\RecursiveEnsureStruct::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\RecursiveFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\RecursiveFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json11 = HH\FIXME\UNSAFE_CAST<mixed, Set<int>>($parsed['remove']);
      $_container12 = Set {};
      foreach($_json11 as $_key9 => $_value10) {
        $_elem13 = 0;
        $_tmp14 = (int)$_value10;
        if ($_tmp14 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem13 = (int)$_tmp14;
        }
        $_container12->add($_elem13);
      }
      $this->remove = $_container12;
    }
  }

}

/**
 * Original thrift struct:-
 * RecursiveField1Patch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/RecursiveField1Patch'))>>
class RecursiveField1Patch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \test\fixtures\patch\Recursive::class,
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?Map<string, \test\fixtures\patch\Recursive>,
    ?'clear' => ?bool,
  );

  const int STRUCTURAL_ID = 2553542170459237600;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: map<string, module.Recursive> assign
   */
  public ?Map<string, \test\fixtures\patch\Recursive> $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;

  public function __construct(?Map<string, \test\fixtures\patch\Recursive> $assign = null, ?bool $clear = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
    );
  }

  public function getName()[]: string {
    return 'RecursiveField1Patch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.RecursiveField1Patch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "module.Recursive",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                                    shape(
                                      "name" => "module.Recursive",
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::RecursiveField1PatchStruct>",
            "underlyingName" => "RecursiveField1PatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \test\fixtures\patch\Recursive>>($parsed['assign']);
      $_container4 = Map {};
      foreach($_json3 as $_key1 => $_value2) {
        $_value5 = \test\fixtures\patch\Recursive::withDefaultValues();
        $_tmp6 = \json_encode($_value2);
        $_tmp7 = \test\fixtures\patch\Recursive::withDefaultValues();
        $_tmp7->readFromJson($_tmp6);
        $_value5 = $_tmp7;
        $_container4[$_key1] = $_value5;
      }
      $this->assign = $_container4;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
  }

}

/**
 * Original thrift struct:-
 * RecursiveFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/RecursiveFieldPatch'))>>
class RecursiveFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'nodes',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\RecursiveField1Patch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'nodes' => -1,
  ];

  const type TConstructorShape = shape(
    ?'nodes' => ?\test\fixtures\patch\RecursiveField1Patch,
  );

  const int STRUCTURAL_ID = 5650747686776624114;
  /**
   * Original thrift field:-
   * -1: module.RecursiveField1Patch nodes
   */
  public ?\test\fixtures\patch\RecursiveField1Patch $nodes;

  public function __construct(?\test\fixtures\patch\RecursiveField1Patch $nodes = null)[] {
    $this->nodes = $nodes;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'nodes'),
    );
  }

  public function getName()[]: string {
    return 'RecursiveFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->nodes = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.RecursiveFieldPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.RecursiveField1Patch",
                    )
                  ),
                )
              ),
              "name" => "nodes",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::RecursiveFieldPatchStruct>",
            "underlyingName" => "RecursiveFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'nodes' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::RecursiveField1PatchStruct>",
                "underlyingName" => "RecursiveField1PatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'nodes') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\RecursiveField1Patch>($parsed['nodes']));
      $_tmp1 = \test\fixtures\patch\RecursiveField1Patch::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->nodes = $_tmp1;
    }
  }

}

/**
 * Original thrift struct:-
 * RecursiveEnsureStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/RecursiveEnsureStruct'))>>
class RecursiveEnsureStruct implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'nodes',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => \test\fixtures\patch\Recursive::class,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'nodes' => -1,
  ];

  const type TConstructorShape = shape(
    ?'nodes' => ?Map<string, \test\fixtures\patch\Recursive>,
  );

  const int STRUCTURAL_ID = 3722360834412776999;
  /**
   * Original thrift field:-
   * -1: map<string, module.Recursive> nodes
   */
  public ?Map<string, \test\fixtures\patch\Recursive> $nodes;

  public function __construct(?Map<string, \test\fixtures\patch\Recursive> $nodes = null)[] {
    $this->nodes = $nodes;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'nodes'),
    );
  }

  public function getName()[]: string {
    return 'RecursiveEnsureStruct';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.RecursiveEnsureStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => \tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "module.Recursive",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                                    shape(
                                      "name" => "module.Recursive",
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "nodes",
              "is_optional" => true,
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'nodes') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Map<string, \test\fixtures\patch\Recursive>>($parsed['nodes']);
      $_container4 = Map {};
      foreach($_json3 as $_key1 => $_value2) {
        $_value5 = \test\fixtures\patch\Recursive::withDefaultValues();
        $_tmp6 = \json_encode($_value2);
        $_tmp7 = \test\fixtures\patch\Recursive::withDefaultValues();
        $_tmp7->readFromJson($_tmp6);
        $_value5 = $_tmp7;
        $_container4[$_key1] = $_value5;
      }
      $this->nodes = $_container4;
    }
  }

}

/**
 * Original thrift struct:-
 * BarPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/BarPatch'))>>
class BarPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\Bar::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
    3 => shape(
      'var' => 'patchPrior',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\BarFieldPatch::class,
    ),
    5 => shape(
      'var' => 'ensure',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\BarEnsureStruct::class,
    ),
    6 => shape(
      'var' => 'patch',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\BarFieldPatch::class,
    ),
    7 => shape(
      'var' => 'remove',
      'is_terse' => true,
      'type' => \TType::SET,
      'etype' => \TType::I16,
      'elem' => shape(
        'type' => \TType::I16,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
    'patchPrior' => 3,
    'ensure' => 5,
    'patch' => 6,
    'remove' => 7,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\Bar,
    ?'clear' => ?bool,
    ?'patchPrior' => ?\test\fixtures\patch\BarFieldPatch,
    ?'ensure' => ?\test\fixtures\patch\BarEnsureStruct,
    ?'patch' => ?\test\fixtures\patch\BarFieldPatch,
    ?'remove' => ?Set<int>,
  );

  const int STRUCTURAL_ID = 7975740035235247535;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.Bar assign
   */
  public ?\test\fixtures\patch\Bar $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;
  /**
   * Patches any previously set values. Applies second.
   *
   * Original thrift field:-
   * 3: module.BarFieldPatch patchPrior
   */
  public ?\test\fixtures\patch\BarFieldPatch $patchPrior;
  /**
   * Initialize fields, using the given defaults. Applies third.
   *
   * Original thrift field:-
   * 5: module.BarEnsureStruct ensure
   */
  public ?\test\fixtures\patch\BarEnsureStruct $ensure;
  /**
   * Patches any set value, including newly set values. Applies last.
   *
   * Original thrift field:-
   * 6: module.BarFieldPatch patch
   */
  public ?\test\fixtures\patch\BarFieldPatch $patch;
  /**
   * Removes entries, if present. Applies third.
   *
   * Original thrift field:-
   * 7: set<patch.FieldId> remove
   */
  public Set<int> $remove;

  public function __construct(?\test\fixtures\patch\Bar $assign = null, ?bool $clear = null, ?\test\fixtures\patch\BarFieldPatch $patchPrior = null, ?\test\fixtures\patch\BarEnsureStruct $ensure = null, ?\test\fixtures\patch\BarFieldPatch $patch = null, ?Set<int> $remove = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
    $this->patchPrior = $patchPrior;
    $this->ensure = $ensure;
    $this->patch = $patch;
    $this->remove = $remove ?? Set {};
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
      Shapes::idx($shape, 'patchPrior'),
      Shapes::idx($shape, 'ensure'),
      Shapes::idx($shape, 'patch'),
      Shapes::idx($shape, 'remove'),
    );
  }

  public function getName()[]: string {
    return 'BarPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
    $this->patchPrior = null;
    $this->ensure = null;
    $this->patch = null;
    $this->remove = Set {};
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.BarPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.Bar",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.BarFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patchPrior",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.BarEnsureStruct",
                    )
                  ),
                )
              ),
              "name" => "ensure",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.BarFieldPatch",
                    )
                  ),
                )
              ),
              "name" => "patch",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "patch.FieldId",
                              "underlyingType" => \tmeta_ThriftType::fromShape(
                                shape(
                                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                                    shape(
                                      "name" => "id.FieldId",
                                      "underlyingType" => \tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE,
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "remove",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::StructPatchAdapter<::test::fixtures::patch::BarPatchStruct>",
            "underlyingName" => "BarPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'patchPrior' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::BarFieldPatchStruct>",
                "underlyingName" => "BarFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
        'ensure' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
              shape(
              )
            ),
          ],
        ),
        'patch' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::BarFieldPatchStruct>",
                "underlyingName" => "BarFieldPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\Bar>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\Bar::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
    if (idx($parsed, 'patchPrior') !== null) {
      $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\BarFieldPatch>($parsed['patchPrior']));
      $_tmp3 = \test\fixtures\patch\BarFieldPatch::withDefaultValues();
      $_tmp3->readFromJson($_tmp2);
      $this->patchPrior = $_tmp3;
    }
    if (idx($parsed, 'ensure') !== null) {
      $_tmp4 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\BarEnsureStruct>($parsed['ensure']));
      $_tmp5 = \test\fixtures\patch\BarEnsureStruct::withDefaultValues();
      $_tmp5->readFromJson($_tmp4);
      $this->ensure = $_tmp5;
    }
    if (idx($parsed, 'patch') !== null) {
      $_tmp6 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\BarFieldPatch>($parsed['patch']));
      $_tmp7 = \test\fixtures\patch\BarFieldPatch::withDefaultValues();
      $_tmp7->readFromJson($_tmp6);
      $this->patch = $_tmp7;
    }
    if (idx($parsed, 'remove') !== null) {
      $_json11 = HH\FIXME\UNSAFE_CAST<mixed, Set<int>>($parsed['remove']);
      $_container12 = Set {};
      foreach($_json11 as $_key9 => $_value10) {
        $_elem13 = 0;
        $_tmp14 = (int)$_value10;
        if ($_tmp14 > 0x7fff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem13 = (int)$_tmp14;
        }
        $_container12->add($_elem13);
      }
      $this->remove = $_container12;
    }
  }

}

/**
 * Original thrift struct:-
 * BarFieldPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/BarFieldPatch'))>>
class BarFieldPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'loop',
      'is_terse' => true,
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\LoopPatch::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'loop' => -1,
  ];

  const type TConstructorShape = shape(
    ?'loop' => ?\test\fixtures\patch\LoopPatch,
  );

  const int STRUCTURAL_ID = 3282171960754554582;
  /**
   * Original thrift field:-
   * -1: module.LoopPatch loop
   */
  public ?\test\fixtures\patch\LoopPatch $loop;

  public function __construct(?\test\fixtures\patch\LoopPatch $loop = null)[] {
    $this->loop = $loop;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'loop'),
    );
  }

  public function getName()[]: string {
    return 'BarFieldPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->loop = null;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.BarFieldPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.LoopPatch",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.LoopPatch",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "loop",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::FieldPatchAdapter<::test::fixtures::patch::BarFieldPatchStruct>",
            "underlyingName" => "BarFieldPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'loop' => shape(
          'field' => dict[
            '\facebook\thrift\annotation\InternBox' => \facebook\thrift\annotation\InternBox::fromShape(
              shape(
              )
            ),
          ],
          'type' => dict[
            '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
              shape(
                "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::LoopPatchStruct>",
                "underlyingName" => "LoopPatchStruct",
                "extraNamespace" => "",
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'loop') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\LoopPatch>($parsed['loop']));
      $_tmp1 = \test\fixtures\patch\LoopPatch::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->loop = $_tmp1;
    }
  }

}

/**
 * Original thrift struct:-
 * BarEnsureStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/BarEnsureStruct'))>>
class BarEnsureStruct implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    -1 => shape(
      'var' => 'loop',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\Loop::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'loop' => -1,
  ];

  const type TConstructorShape = shape(
    ?'loop' => ?\test\fixtures\patch\Loop,
  );

  const int STRUCTURAL_ID = 2398939770440216623;
  /**
   * Original thrift field:-
   * -1: module.Loop loop
   */
  public ?\test\fixtures\patch\Loop $loop;

  public function __construct(?\test\fixtures\patch\Loop $loop = null)[] {
    $this->loop = $loop;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'loop'),
    );
  }

  public function getName()[]: string {
    return 'BarEnsureStruct';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.BarEnsureStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => -1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => \tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.Loop",
                      "underlyingType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => \tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.Loop",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "loop",
              "is_optional" => true,
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Frozen2Exclude' => \facebook\thrift\annotation\cpp\Frozen2Exclude::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
        'loop' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\op\AssignOnlyPatch' => \facebook\thrift\op\AssignOnlyPatch::fromShape(
              shape(
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'loop') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\Loop>($parsed['loop']));
      $_tmp1 = \test\fixtures\patch\Loop::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->loop = $_tmp1;
    }
  }

}

/**
 * Original thrift struct:-
 * LoopPatch
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/patch/LoopPatch'))>>
class LoopPatch implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'assign',
      'type' => \TType::STRUCT,
      'class' => \test\fixtures\patch\Loop::class,
    ),
    2 => shape(
      'var' => 'clear',
      'is_terse' => true,
      'type' => \TType::BOOL,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'assign' => 1,
    'clear' => 2,
  ];

  const type TConstructorShape = shape(
    ?'assign' => ?\test\fixtures\patch\Loop,
    ?'clear' => ?bool,
  );

  const int STRUCTURAL_ID = 3189284720730559067;
  /**
   * Assigns to a (set) value.
   *
   * If set, all other operations are ignored.
   *
   * Note: Optional and union fields must be set before assigned.
   *
   *
   * Original thrift field:-
   * 1: module.Loop assign
   */
  public ?\test\fixtures\patch\Loop $assign;
  /**
   * Clears a value. Applies first.
   *
   * Original thrift field:-
   * 2: bool clear
   */
  public bool $clear;

  public function __construct(?\test\fixtures\patch\Loop $assign = null, ?bool $clear = null)[] {
    $this->assign = $assign;
    $this->clear = $clear ?? false;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'assign'),
      Shapes::idx($shape, 'clear'),
    );
  }

  public function getName()[]: string {
    return 'LoopPatch';
  }

  public function clearTerseFields()[write_props]: void {
    $this->clear = false;
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.LoopPatch",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => \tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.Loop",
                    )
                  ),
                )
              ),
              "name" => "assign",
              "is_optional" => true,
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
                )
              ),
              "name" => "clear",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\cpp\Adapter' => \facebook\thrift\annotation\cpp\Adapter::fromShape(
          shape(
            "name" => "::apache::thrift::op::detail::AssignPatchAdapter<::test::fixtures::patch::LoopPatchStruct>",
            "underlyingName" => "LoopPatchStruct",
            "extraNamespace" => "",
          )
        ),
      ],
      'fields' => dict[
        'assign' => shape(
          'field' => dict[],
          'type' => dict[
            '\facebook\thrift\op\AssignOnlyPatch' => \facebook\thrift\op\AssignOnlyPatch::fromShape(
              shape(
              )
            ),
          ],
        ),
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'assign') !== null) {
      $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\patch\Loop>($parsed['assign']));
      $_tmp1 = \test\fixtures\patch\Loop::withDefaultValues();
      $_tmp1->readFromJson($_tmp0);
      $this->assign = $_tmp1;
    }
    if (idx($parsed, 'clear') !== null) {
      $this->clear = HH\FIXME\UNSAFE_CAST<mixed, bool>($parsed['clear']);
    }
  }

}