code: protected function getSchemaResponse($schemaID, $form = null, ValidationResult $errors = null, $extraData = [])
      {
          $parts = $this->owner->getRequest()->getHeader(LeftAndMain::SCHEMA_HEADER);
          $data = $this->owner
              ->getFormSchema()
              ->getMultipartSchema($parts, $schemaID, $form, $errors);
  
          if ($extraData) {
              $data = array_merge($data, $extraData);
          }
  
          $response = HTTPResponse::create(Convert::raw2json($data));
          $response->addHeader('Content-Type', 'application/json');
  
          return $response;
      }
docs: Generate schema for the given form based on the X-Formschema-Request header value
  
  @todo Remove duplication. See https://github.com/silverstripe/silverstripe-admin/issues/240
  
  @param string $schemaID ID for this schema. Required.
  @param Form $form Required for 'state' or 'schema' response
  @param ValidationResult $errors Required for 'error' response
  @param array $extraData Any extra data to be merged with the schema response
  @return HTTPResponse