code: def metadata2properties(self, field):
          
          # Dasherize metadata that starts with x_
          metadata = {
              key.replace("_", "-") if key.startswith("x_") else key: value
              for key, value in iteritems(field.metadata)
          }
  
          # Avoid validation error with "Additional properties not allowed"
          ret = {
              key: value
              for key, value in metadata.items()
              if key in _VALID_PROPERTIES or key.startswith(_VALID_PREFIX)
          }
          return ret
docs: Return a dictionary of properties extracted from field Metadata
  
          Will include field metadata that are valid properties of `OpenAPI schema
          objects
          <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject>`_
          (e.g. “description”, “enum”, “example”).
  
          In addition, `specification extensions
          <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#specification-extensions>`_
          are supported.  Prefix `x_` to the desired extension when passing the
          keyword argument to the field constructor. apispec will convert `x_` to
          `x-` to comply with OpenAPI.
  
          :param Field field: A marshmallow field.
          :rtype: dict