You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Michael Vorburger (Jira)" <ji...@apache.org> on 2020/10/21 19:18:00 UTC

[jira] [Commented] (FINERACT-1227) Client Java API for binary document files and images are generated wrong

    [ https://issues.apache.org/jira/browse/FINERACT-1227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17218521#comment-17218521 ] 

Michael Vorburger commented on FINERACT-1227:
---------------------------------------------

The problem is more general than the {{DocumentsApi.downloadFile()}} .. even the {{DocumentsApi.createDocument()}}, as generated for us by CodeGen from our OpenAPI/Swagger YAML, is pretty useless as-is.. these generated classes are all complete non-sense:

* org.apache.fineract.client.models.Binary
* org.apache.fineract.client.models.BodyPartMediaType
* org.apache.fineract.client.models.FormDataContentDisposition
* org.apache.fineract.client.models.ContentDisposition

These shouldn't be generated models data classes mapping to JSON, but need to framework types.

Instead of e.g. {{@retrofit2.http.Part("file") Binary file}} on {{DocumentsApi.createDocument()}}, it needs to be a {{@retrofit2.http.Part okhttp3.MultipartBody.Part file}} - and we need a helper to create this for client users given e.g. a File or an InputStream etc.

What I'll do in FINERACT-1218 for the short term is to simply "fork" the code generated {{DocumentsApi}} into a {{DocumentsApiFixed}} maintained as src. I'll keep this issue open for potentially whatever needs to be fixed "at source" for this to perhaps eventually no longer be required (so... fix the annotations in Java so that the YAML generated is more appropriate so that the Java code generated is usable).

I think this also means that our OpenAPI/Swagger YAML for binary document files and images is useless (incorect), as is.

[~aleks] [~ptuomola] FYI.

> Client Java API for binary document files and images are generated wrong
> ------------------------------------------------------------------------
>
>                 Key: FINERACT-1227
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1227
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: SDK
>    Affects Versions: 1.5.0
>            Reporter: Michael Vorburger
>            Priority: Major
>             Fix For: 1.5.0
>
>
> The {{org.apache.fineract.client.services.DocumentsApi.downloadFile(String, Long, Long)}} (for {{_entityType_/_entityId_/documents/_documentId_/attachment}}) returns {{Call<Void>}}.. it's missing the binary downloaded file?
> Must be something wrong in the Swagger annotations.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)