code: final public function toYaml(array $options = [])
      {
          try {
              if (null === self::$yamlSerializer) {
                  self::$yamlSerializer = new YamlSerializer();
              }
              return self::$yamlSerializer->serialize($this, $options);
          } catch (\Exception $e) {
              return sprintf(
                  'Failed to render [%s] as a yaml string with error: %s',
                  self::schema()->toString(),
                  $e->getMessage()
              );
          }
      }
docs: {@inheritdoc}