prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add email to valid types in custom-form
  **Current**
  Currently we are not able to set an email type to the custom-form which leads to `Error: 422`.
  
  **Expected**
  email should be a valid type for the custom-form
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `app/api/custom_forms.py`
  Content:
  ```
  1 from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
  2 from marshmallow_jsonapi.flask import Schema, Relationship
  3 from marshmallow_jsonapi import fields
  4 import marshmallow.validate as validate
  5 from app.api.helpers.permissions import jwt_required
  6 from flask_rest_jsonapi.exceptions import ObjectNotFound
  7 
  8 from app.api.bootstrap import api
  9 from app.api.helpers.utilities import dasherize
  10 from app.models import db
  11 from app.models.custom_form import CustomForms
  12 from app.models.event import Event
  13 from app.api.helpers.db import safe_query
  14 from app.api.helpers.utilities import require_relationship
  15 from app.api.helpers.permission_manager import has_access
  16 from app.api.helpers.query import event_query
  17 
  18 
  19 class CustomFormSchema(Schema):
  20     """
  21     API Schema for Custom Forms database model
  22     """
  23     class Meta:
  24         """
  25         Meta class for CustomForm Schema
  26         """
  27         type_ = 'custom-form'
  28         self_view = 'v1.custom_form_detail'
  29         self_view_kwargs = {'id': '<id>'}
  30         inflect = dasherize
  31 
  32     id = fields.Integer(dump_only=True)
  33     field_identifier = fields.Str(required=True)
  34     form = fields.Str(required=True)
  35     type = fields.Str(default="text", validate=validate.OneOf(
  36         choices=["text", "checkbox", "select", "file", "image"]))
  37     is_required = fields.Boolean(default=False)
  38     is_included = fields.Boolean(default=False)
  39     is_fixed = fields.Boolean(default=False)
  40     event = Relationship(attribute='event',
  41                          self_view='v1.custom_form_event',
  42                          self_view_kwargs={'id': '<id>'},
  43                          related_view='v1.event_detail',
  44                          related_view_kwargs={'custom_form_id': '<id>'},
  45                          schema='EventSchema',
  46                          type_='event')
  47 
  48 
  49 class CustomFormListPost(ResourceList):
  50     """
  51     Create and List Custom Forms
  52     """
  53 
  54     def before_post(self, args, kwargs, data):
  55         """
  56         method to check for required relationship with event
  57         :param args:
  58         :param kwargs:
  59         :param data:
  60         :return:
  61         """
  62         require_relationship(['event'], data)
  63         if not has_access('is_coorganizer', event_id=data['event']):
  64             raise ObjectNotFound({'parameter': 'event_id'},
  65                                  "Event: {} not found".format(data['event_id']))
  66 
  67     schema = CustomFormSchema
  68     methods = ['POST', ]
  69     data_layer = {'session': db.session,
  70                   'model': CustomForms
  71                   }
  72 
  73 
  74 class CustomFormList(ResourceList):
  75     """
  76     Create and List Custom Forms
  77     """
  78     def query(self, view_kwargs):
  79         """
  80         query method for different view_kwargs
  81         :param view_kwargs:
  82         :return:
  83         """
  84         query_ = self.session.query(CustomForms)
  85         query_ = event_query(self, query_, view_kwargs)
  86         return query_
  87 
  88     view_kwargs = True
  89     decorators = (jwt_required, )
  90     methods = ['GET', ]
  91     schema = CustomFormSchema
  92     data_layer = {'session': db.session,
  93                   'model': CustomForms,
  94                   'methods': {
  95                       'query': query
  96                   }}
  97 
  98 
  99 class CustomFormDetail(ResourceDetail):
  100     """
  101     CustomForm Resource
  102     """
  103 
  104     def before_get_object(self, view_kwargs):
  105         """
  106         before get method
  107         :param view_kwargs:
  108         :return:
  109         """
  110         event = None
  111         if view_kwargs.get('event_id'):
  112             event = safe_query(self, Event, 'id', view_kwargs['event_id'], 'event_id')
  113         elif view_kwargs.get('event_identifier'):
  114             event = safe_query(self, Event, 'identifier', view_kwargs['event_identifier'], 'event_identifier')
  115 
  116         if event:
  117             custom_form = safe_query(self, CustomForms, 'event_id', event.id, 'event_id')
  118             view_kwargs['id'] = custom_form.id
  119 
  120     decorators = (api.has_permission('is_coorganizer', fetch='event_id',
  121                   fetch_as="event_id", model=CustomForms, methods="PATCH,DELETE"), )
  122     schema = CustomFormSchema
  123     data_layer = {'session': db.session,
  124                   'model': CustomForms}
  125 
  126 
  127 class CustomFormRelationshipRequired(ResourceRelationship):
  128     """
  129     CustomForm Relationship (Required)
  130     """
  131     decorators = (api.has_permission('is_coorganizer', fetch='event_id',
  132                                      fetch_as="event_id", model=CustomForms, methods="PATCH"),)
  133     methods = ['GET', 'PATCH']
  134     schema = CustomFormSchema
  135     data_layer = {'session': db.session,
  136                   'model': CustomForms}
  137
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/app/api/custom_forms.py b/app/api/custom_forms.py
  --- a/app/api/custom_forms.py
  +++ b/app/api/custom_forms.py
  @@ -33,7 +33,7 @@
       field_identifier = fields.Str(required=True)
       form = fields.Str(required=True)
       type = fields.Str(default="text", validate=validate.OneOf(
  -        choices=["text", "checkbox", "select", "file", "image"]))
  +        choices=["text", "checkbox", "select", "file", "image", "email"]))
       is_required = fields.Boolean(default=False)
       is_included = fields.Boolean(default=False)
       is_fixed = fields.Boolean(default=False)
  
verification_info: {"golden_diff": "diff --git a/app/api/custom_forms.py b/app/api/custom_forms.py\n--- a/app/api/custom_forms.py\n+++ b/app/api/custom_forms.py\n@@ -33,7 +33,7 @@\n     field_identifier = fields.Str(required=True)\n     form = fields.Str(required=True)\n     type = fields.Str(default=\"text\", validate=validate.OneOf(\n-        choices=[\"text\", \"checkbox\", \"select\", \"file\", \"image\"]))\n+        choices=[\"text\", \"checkbox\", \"select\", \"file\", \"image\", \"email\"]))\n     is_required = fields.Boolean(default=False)\n     is_included = fields.Boolean(default=False)\n     is_fixed = fields.Boolean(default=False)\n", "issue": "Add email to valid types in custom-form\n**Current**\r\nCurrently we are not able to set an email type to the custom-form which leads to `Error: 422`.\r\n\r\n**Expected**\r\nemail should be a valid type for the custom-form\n", "before_files": [{"content": "from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\nfrom marshmallow_jsonapi.flask import Schema, Relationship\nfrom marshmallow_jsonapi import fields\nimport marshmallow.validate as validate\nfrom app.api.helpers.permissions import jwt_required\nfrom flask_rest_jsonapi.exceptions import ObjectNotFound\n\nfrom app.api.bootstrap import api\nfrom app.api.helpers.utilities import dasherize\nfrom app.models import db\nfrom app.models.custom_form import CustomForms\nfrom app.models.event import Event\nfrom app.api.helpers.db import safe_query\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.helpers.permission_manager import has_access\nfrom app.api.helpers.query import event_query\n\n\nclass CustomFormSchema(Schema):\n    \"\"\"\n    API Schema for Custom Forms database model\n    \"\"\"\n    class Meta:\n        \"\"\"\n        Meta class for CustomForm Schema\n        \"\"\"\n        type_ = 'custom-form'\n        self_view = 'v1.custom_form_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    id = fields.Integer(dump_only=True)\n    field_identifier = fields.Str(required=True)\n    form = fields.Str(required=True)\n    type = fields.Str(default=\"text\", validate=validate.OneOf(\n        choices=[\"text\", \"checkbox\", \"select\", \"file\", \"image\"]))\n    is_required = fields.Boolean(default=False)\n    is_included = fields.Boolean(default=False)\n    is_fixed = fields.Boolean(default=False)\n    event = Relationship(attribute='event',\n                         self_view='v1.custom_form_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'custom_form_id': '<id>'},\n                         schema='EventSchema',\n                         type_='event')\n\n\nclass CustomFormListPost(ResourceList):\n    \"\"\"\n    Create and List Custom Forms\n    \"\"\"\n\n    def before_post(self, args, kwargs, data):\n        \"\"\"\n        method to check for required relationship with event\n        :param args:\n        :param kwargs:\n        :param data:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ObjectNotFound({'parameter': 'event_id'},\n                                 \"Event: {} not found\".format(data['event_id']))\n\n    schema = CustomFormSchema\n    methods = ['POST', ]\n    data_layer = {'session': db.session,\n                  'model': CustomForms\n                  }\n\n\nclass CustomFormList(ResourceList):\n    \"\"\"\n    Create and List Custom Forms\n    \"\"\"\n    def query(self, view_kwargs):\n        \"\"\"\n        query method for different view_kwargs\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        query_ = self.session.query(CustomForms)\n        query_ = event_query(self, query_, view_kwargs)\n        return query_\n\n    view_kwargs = True\n    decorators = (jwt_required, )\n    methods = ['GET', ]\n    schema = CustomFormSchema\n    data_layer = {'session': db.session,\n                  'model': CustomForms,\n                  'methods': {\n                      'query': query\n                  }}\n\n\nclass CustomFormDetail(ResourceDetail):\n    \"\"\"\n    CustomForm Resource\n    \"\"\"\n\n    def before_get_object(self, view_kwargs):\n        \"\"\"\n        before get method\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        event = None\n        if view_kwargs.get('event_id'):\n            event = safe_query(self, Event, 'id', view_kwargs['event_id'], 'event_id')\n        elif view_kwargs.get('event_identifier'):\n            event = safe_query(self, Event, 'identifier', view_kwargs['event_identifier'], 'event_identifier')\n\n        if event:\n            custom_form = safe_query(self, CustomForms, 'event_id', event.id, 'event_id')\n            view_kwargs['id'] = custom_form.id\n\n    decorators = (api.has_permission('is_coorganizer', fetch='event_id',\n                  fetch_as=\"event_id\", model=CustomForms, methods=\"PATCH,DELETE\"), )\n    schema = CustomFormSchema\n    data_layer = {'session': db.session,\n                  'model': CustomForms}\n\n\nclass CustomFormRelationshipRequired(ResourceRelationship):\n    \"\"\"\n    CustomForm Relationship (Required)\n    \"\"\"\n    decorators = (api.has_permission('is_coorganizer', fetch='event_id',\n                                     fetch_as=\"event_id\", model=CustomForms, methods=\"PATCH\"),)\n    methods = ['GET', 'PATCH']\n    schema = CustomFormSchema\n    data_layer = {'session': db.session,\n                  'model': CustomForms}\n", "path": "app/api/custom_forms.py"}], "after_files": [{"content": "from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\nfrom marshmallow_jsonapi.flask import Schema, Relationship\nfrom marshmallow_jsonapi import fields\nimport marshmallow.validate as validate\nfrom app.api.helpers.permissions import jwt_required\nfrom flask_rest_jsonapi.exceptions import ObjectNotFound\n\nfrom app.api.bootstrap import api\nfrom app.api.helpers.utilities import dasherize\nfrom app.models import db\nfrom app.models.custom_form import CustomForms\nfrom app.models.event import Event\nfrom app.api.helpers.db import safe_query\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.helpers.permission_manager import has_access\nfrom app.api.helpers.query import event_query\n\n\nclass CustomFormSchema(Schema):\n    \"\"\"\n    API Schema for Custom Forms database model\n    \"\"\"\n    class Meta:\n        \"\"\"\n        Meta class for CustomForm Schema\n        \"\"\"\n        type_ = 'custom-form'\n        self_view = 'v1.custom_form_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    id = fields.Integer(dump_only=True)\n    field_identifier = fields.Str(required=True)\n    form = fields.Str(required=True)\n    type = fields.Str(default=\"text\", validate=validate.OneOf(\n        choices=[\"text\", \"checkbox\", \"select\", \"file\", \"image\", \"email\"]))\n    is_required = fields.Boolean(default=False)\n    is_included = fields.Boolean(default=False)\n    is_fixed = fields.Boolean(default=False)\n    event = Relationship(attribute='event',\n                         self_view='v1.custom_form_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'custom_form_id': '<id>'},\n                         schema='EventSchema',\n                         type_='event')\n\n\nclass CustomFormListPost(ResourceList):\n    \"\"\"\n    Create and List Custom Forms\n    \"\"\"\n\n    def before_post(self, args, kwargs, data):\n        \"\"\"\n        method to check for required relationship with event\n        :param args:\n        :param kwargs:\n        :param data:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ObjectNotFound({'parameter': 'event_id'},\n                                 \"Event: {} not found\".format(data['event_id']))\n\n    schema = CustomFormSchema\n    methods = ['POST', ]\n    data_layer = {'session': db.session,\n                  'model': CustomForms\n                  }\n\n\nclass CustomFormList(ResourceList):\n    \"\"\"\n    Create and List Custom Forms\n    \"\"\"\n    def query(self, view_kwargs):\n        \"\"\"\n        query method for different view_kwargs\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        query_ = self.session.query(CustomForms)\n        query_ = event_query(self, query_, view_kwargs)\n        return query_\n\n    view_kwargs = True\n    decorators = (jwt_required, )\n    methods = ['GET', ]\n    schema = CustomFormSchema\n    data_layer = {'session': db.session,\n                  'model': CustomForms,\n                  'methods': {\n                      'query': query\n                  }}\n\n\nclass CustomFormDetail(ResourceDetail):\n    \"\"\"\n    CustomForm Resource\n    \"\"\"\n\n    def before_get_object(self, view_kwargs):\n        \"\"\"\n        before get method\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        event = None\n        if view_kwargs.get('event_id'):\n            event = safe_query(self, Event, 'id', view_kwargs['event_id'], 'event_id')\n        elif view_kwargs.get('event_identifier'):\n            event = safe_query(self, Event, 'identifier', view_kwargs['event_identifier'], 'event_identifier')\n\n        if event:\n            custom_form = safe_query(self, CustomForms, 'event_id', event.id, 'event_id')\n            view_kwargs['id'] = custom_form.id\n\n    decorators = (api.has_permission('is_coorganizer', fetch='event_id',\n                  fetch_as=\"event_id\", model=CustomForms, methods=\"PATCH,DELETE\"), )\n    schema = CustomFormSchema\n    data_layer = {'session': db.session,\n                  'model': CustomForms}\n\n\nclass CustomFormRelationshipRequired(ResourceRelationship):\n    \"\"\"\n    CustomForm Relationship (Required)\n    \"\"\"\n    decorators = (api.has_permission('is_coorganizer', fetch='event_id',\n                                     fetch_as=\"event_id\", model=CustomForms, methods=\"PATCH\"),)\n    methods = ['GET', 'PATCH']\n    schema = CustomFormSchema\n    data_layer = {'session': db.session,\n                  'model': CustomForms}\n", "path": "app/api/custom_forms.py"}]}