code: def field2choices(self, field, **kwargs):
          
          attributes = {}
  
          comparable = [
              validator.comparable
              for validator in field.validators
              if hasattr(validator, "comparable")
          ]
          if comparable:
              attributes["enum"] = comparable
          else:
              choices = [
                  OrderedSet(validator.choices)
                  for validator in field.validators
                  if hasattr(validator, "choices")
              ]
              if choices:
                  attributes["enum"] = list(functools.reduce(operator.and_, choices))
  
          return attributes
docs: Return the dictionary of OpenAPI field attributes for valid choices definition
  
          :param Field field: A marshmallow field.
          :rtype: dict