You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OpenAPI Generator for Dart is generating code that includes a call to MultipartFile.listFromJson(json[r'photos']), but the MultipartFile class (from the http package) does not have a listFromJson method. This results in a compilation error:
The method 'listFromJson' isn't defined for the type 'MultipartFile'.
Steps to reproduce
Use the OpenAPI Generator for Dart to generate models and API code from an OpenAPI specification that includes a field expecting a list of MultipartFile objects (e.g., photos).
The generated code will include a line like this: photos: MultipartFile.listFromJson(json[r'photos']),
Attempt to compile the generated code. The compilation will fail with the error mentioned above.
Minimal openapi specification
Here’s a minimal OpenAPI specification that reproduces the issue:
@Openapi(
inputSpec: InputSpec(
path: 'bin/restrox-swagger.json',
),
generatorName: Generator.dart,
outputDirectory: 'lib/data/generated',
cleanSubOutputDirectory: ['lib/data/generated'],
)
class ApiClient {}
### Expected behavior
The generated code should handle the photos field correctly, either by:
Providing a valid method to deserialize a list of MultipartFile objects, or
Generating code that uses a supported method for handling file uploads (e.g., MultipartFile.fromFileSync or similar).
### Logs
```text
No specific logs are available as this is a compilation error.
The error message is:
The method 'listFromJson' isn't defined for the type 'MultipartFile'.
Screenshots
No response
Platform
Linux
Library version
6.1.0
Flutter version
3.27.3
Flutter channel
stable
Additional context
The issue arises because the MultipartFile class from the http package does not have a listFromJson method. The OpenAPI Generator is not correctly handling the mapping of file lists to MultipartFile objects. This requires either a template modification or a built in feature to correctly handle the multipart file generation.
The text was updated successfully, but these errors were encountered:
Description of the bug
The OpenAPI Generator for Dart is generating code that includes a call to
MultipartFile.listFromJson(json[r'photos']),
but the MultipartFile class (from the http package) does not have a listFromJson method. This results in a compilation error:Steps to reproduce
photos: MultipartFile.listFromJson(json[r'photos']),
Minimal openapi specification
Here’s a minimal OpenAPI specification that reproduces the issue:
Annotation used
Here’s the @openapi annotation I used:
Screenshots
No response
Platform
Linux
Library version
6.1.0
Flutter version
3.27.3
Flutter channel
stable
Additional context
The issue arises because the MultipartFile class from the http package does not have a listFromJson method. The OpenAPI Generator is not correctly handling the mapping of file lists to MultipartFile objects. This requires either a template modification or a built in feature to correctly handle the multipart file generation.
The text was updated successfully, but these errors were encountered: