              if isinstance(field, serializers.HiddenField):
                  continue
  
              if field.required:
                  required.append(field.field_name)
  
              schema = self.map_field(field)
              if field.read_only:
                  schema['readOnly'] = True
              if field.write_only:
 
</s> remove             properties[field.field_name] = schema
 </s> add             properties[self.get_field_name(field)] = schema
                required.append(self.get_field_name(field))
              if isinstance(field, serializers.HiddenField):
                  continue
  
              if field.required:
                required.append(self.get_field_name(field))
  
              schema = self.map_field(field)
              if field.read_only:
                  schema['readOnly'] = True
              if field.write_only:
keep keep keep keep replace keep keep keep keep keep
 Add a method for getting serializer field name (OpenAPI) (#7493)

* Add a method for getting serializer field name

* Add docs and test

Co-authored-by: Tom Christie <tom@tomchristie.com> 
rest_framework/schemas/openapi.py