I am currently working on a generator that uses the http package not unlike retrofit, and i find myself in a rather unpleasant position of realizing that MultipartFile leaks the field name to what i consider the wrong place.
I could create my own file part class, but I think that the current api is kinda inconsistent, as the field names should only be relevant to the request, not the file contents/source.
I would suggest either combining both fields and files into Map<String, Object /*String | MultipartFile*/> fields or changing fields to be Map<String, MultipartFile> fields
This would be a breaking change, but i consider it better than what we have now, which i consider bad practice.
Especially since MultipartFile doesnt actually use the field name anywhere - its just a carrier, which could be better served as mentioned above.
Alternatively, provide a means of modifying the field, such as making it a mutable field rather than a parameter, or a copy/clone method.
I am currently working on a generator that uses the http package not unlike retrofit, and i find myself in a rather unpleasant position of realizing that MultipartFile leaks the field name to what i consider the wrong place.
I could create my own file part class, but I think that the current api is kinda inconsistent, as the field names should only be relevant to the request, not the file contents/source.
I would suggest either combining both
fieldsandfilesintoMap<String, Object /*String | MultipartFile*/> fieldsor changingfieldsto beMap<String, MultipartFile> fieldsThis would be a breaking change, but i consider it better than what we have now, which i consider bad practice.
Especially since
MultipartFiledoesnt actually use the field name anywhere - its just a carrier, which could be better served as mentioned above.Alternatively, provide a means of modifying the field, such as making it a mutable field rather than a parameter, or a copy/clone method.