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

endzeit edited comment on NIFI-12503 at 3/8/24 9:42 AM:
--------------------------------------------------------

The latest commit version of 2.x seems to not he affected.

This issue seems to only exist on the 1.x branch.

It affects other endpoint that use multipart/form-data as well, e.g.
{code:java}
/process-groups/{id}/templates/upload Uploads a template{code}
Here only one of the two form-data parameters is displayed correctly, the other 
one is displayed without name and said to be expected in the body, instead of 
as part of the form-data; similar to the endpoint mentioned in the issue itself.

This issue can be seen in the generated {{swagger.json}} under 
{{nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/target/swagger-ui}}
 already, thus is not an issue of the rendered documentation itself.
{code:java}
"/process-groups/{id}/templates/upload" : {
      "post" : {
        "tags" : [ "process-groups" ],
        "summary" : "Uploads a template",
        "description" : "",
        "operationId" : "uploadTemplate",
        "consumes" : [ "multipart/form-data" ],
        "produces" : [ "application/xml" ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "The process group id.",
          "required" : true,
          "type" : "string"
        }, {
          "in" : "body",
          "name" : "body",
          "description" : "Acknowledges that this node is disconnected to allow 
for mutable requests to proceed.",
          "required" : false,
          "schema" : {
            "type" : "boolean"
          }
        }, {
          "name" : "template",
          "in" : "formData",
          "description" : "The binary content of the template file being 
uploaded.",
          "required" : true,
          "type" : "file"
        } ],
        "responses" : ... {code}
The declaration side of the endpoints in 
{{nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java}}
 looks fine and has not changed for a long time.

-I suspect there is either an issue in the Swagger itself, introduced into NiFi 
by using a newer version, a new Swagger version requiring a different type of 
declaration or a change in the generation procedure of NiFi itself.-

The documentation is broken in the most recent release version for 1.x which is 
1.25.0.
However, it was broken already for:
 - 
[1.24.0|https://web.archive.org/web/20231208064943/https://nifi.apache.org/docs.html]
 
 - 
[1.23.2|https://web.archive.org/web/20231106213006/https://nifi.apache.org/docs.html]
 - ...
 - 
[1.19.1|https://web.archive.org/web/20230315024356/https://nifi.apache.org/docs.html]
 - ...
 - 
[1.14.0|https://web.archive.org/web/20211021223339/https://nifi.apache.org/docs.html]
 - 
[1.13.2|https://web.archive.org/web/20201004172411/http://nifi.apache.org/docs.html]
 - 
[1.10.0|https://web.archive.org/web/20190906190320/http://nifi.apache.org:80/docs.html]

*Looking at the documentation of all these older version of NiFi in Wayback 
Machine, it looks like this never worked in the first place.*

It looks like the issue might stem from the Maven plugin used for the spec 
generation, see [issue 
#352|https://github.com/kongchen/swagger-maven-plugin/issues/352] in the 
project. As outlined in the issue, there is a workaround that involves 
declaring the param a second time as {{@ApiImplicitParam}} which seems to work, 
as the only form parameter visible in the documentation for 
{{/process-groups/id/templates/upload}} has this declared.


was (Author: endzeitbegins):
The latest commit version of 2.x seems to not he affected.

This issue seems to only exist on the 1.x branch.

It affects other endpoint that use multipart/form-data as well, e.g.
{code:java}
/process-groups/{id}/templates/upload Uploads a template{code}
Here only one of the two form-data parameters is displayed correctly, the other 
one is displayed without name and said to be expected in the body, instead of 
as part of the form-data; similar to the endpoint mentioned in the issue itself.

This issue can be seen in the generated {{swagger.json}} under 
{{nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/target/swagger-ui}}
 already, thus is not an issue of the rendered documentation itself.
{code:java}
"/process-groups/{id}/templates/upload" : {
      "post" : {
        "tags" : [ "process-groups" ],
        "summary" : "Uploads a template",
        "description" : "",
        "operationId" : "uploadTemplate",
        "consumes" : [ "multipart/form-data" ],
        "produces" : [ "application/xml" ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "The process group id.",
          "required" : true,
          "type" : "string"
        }, {
          "in" : "body",
          "name" : "body",
          "description" : "Acknowledges that this node is disconnected to allow 
for mutable requests to proceed.",
          "required" : false,
          "schema" : {
            "type" : "boolean"
          }
        }, {
          "name" : "template",
          "in" : "formData",
          "description" : "The binary content of the template file being 
uploaded.",
          "required" : true,
          "type" : "file"
        } ],
        "responses" : ... {code}
The declaration side of the endpoints in 
{{nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java}}
 looks fine and has not changed for a long time.

-I suspect there is either an issue in the Swagger itself, introduced into NiFi 
by using a newer version, a new Swagger version requiring a different type of 
declaration or a change in the generation procedure of NiFi itself.-

The documentation is broken in the most recent release version for 1.x which is 
1.25.0.
However, it was broken already for:
 - 
[1.24.0|https://web.archive.org/web/20231208064943/https://nifi.apache.org/docs.html]
 
 - 
[1.23.2|https://web.archive.org/web/20231106213006/https://nifi.apache.org/docs.html]
 - ...
 - 
[1.19.1|https://web.archive.org/web/20230315024356/https://nifi.apache.org/docs.html]
 - ...
 - 
[1.14.0|https://web.archive.org/web/20211021223339/https://nifi.apache.org/docs.html]
 - 
[1.13.2|https://web.archive.org/web/20201004172411/http://nifi.apache.org/docs.html]
 - 
[1.10.0|https://web.archive.org/web/20190906190320/http://nifi.apache.org:80/docs.html]

*Looking at the documentation of all these older version of NiFi in Wayback 
Machine, it looks like this never worked in the first place.*

It looks like the issue might stem from the Maven plugin used for the spec 
generation, see [issue 
#352|https://github.com/kongchen/swagger-maven-plugin/issues/352] in the 
project. As outlined in the issue, there is a workaround that involves 
declaring the param a second time as {{@ApiImplicitParam}} which seems to work, 
as the only form parameter visible in the documentation for 
{{/process-groups/{id}/templates/upload}} has this declared.

> Missing Documentation for nifi-api
> ----------------------------------
>
>                 Key: NIFI-12503
>                 URL: https://issues.apache.org/jira/browse/NIFI-12503
>             Project: Apache NiFi
>          Issue Type: Improvement
>    Affects Versions: 1.25.0
>            Reporter: Steven Matison
>            Assignee: endzeit
>            Priority: Minor
>         Attachments: SAMSAL_0-1701894321710.png
>
>
> Community user has noticed that nifi-api docs are missing required request 
> values.  One such example is groupName on the api call for uploading 
> process-groups:
> /process-groups/upload
>  
>  
> More dialouge and original conversation here:
> [https://community.cloudera.com/t5/Support-Questions/NIFI-API-REST-Upload-Json-definition-flow-file/m-p/380384#M244057]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to