Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-12298 add swagger annotations for createExtensionBundleVersion form fields #7961

Closed
wants to merge 1 commit into from

Conversation

Hexoplon
Copy link
Contributor

Summary

NIFI-12298

The current swagger annotations for the
createExtensionBundleVersion function in BucketBundleResource results in the form parameters for 'file' and 'sha256' being left out of the generated swagger api defenition for the /buckets/{bucketId}/bundles/{bundleType} endpoint.

By adding a
ApiImplicitParams annotation for both these fields, swagger will correctly interpret these and add them as fields to the endpoint.

When generating swagger clients, this change is required to correctly support the necessary input arguments.

Swagger defenition of endpoint BEFORE changes:

"/buckets/{bucketId}/bundles/{bundleType}" : {
      "post" : {
        "tags" : [ "Swagger Resource" ],
        "summary" : "Create extension bundle version",
        "description" : "Creates a version of an extension bundle by uploading a binary artifact. If an extension bundle already exists in the given bucket with the same group id and artifact id as that of the bundle being uploaded, then it will be added as a new version to the existing bundle. If an extension bundle does not already exist in the given bucket with the same group id and artifact id, then a new extension bundle will be created and this version will be added to the new bundle. Client's may optionally supply a SHA-256 in hex format through the multi-part form field 'sha256'. If supplied, then this value will be compared against the SHA-256 computed by the server, and the bundle will be rejected if the values do not match. If not supplied, the bundle will be accepted, but will be marked to indicate that the client did not supply a SHA-256 during creation. \n\nNOTE: This endpoint is subject to change as NiFi Registry and its REST API evolve.",
        "operationId" : "createExtensionBundleVersion",
        "consumes" : [ "multipart/form-data" ],
        "produces" : [ "application/json" ],
        "parameters" : [ {
          "name" : "bucketId",
          "in" : "path",
          "description" : "The bucket identifier",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "bundleType",
          "in" : "path",
          "description" : "The type of the bundle",
          "required" : true,
          "type" : "string",
          "enum" : [ "nifi-nar", "minifi-cpp" ]
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/BundleVersion"
            }
          },
          "400" : {
            "description" : "NiFi Registry was unable to complete the request because it was invalid. The request should not be retried without modification."
          },
          "401" : {
            "description" : "Client could not be authenticated."
          },
          "403" : {
            "description" : "Client is not authorized to make this request."
          },
          "404" : {
            "description" : "The specified resource could not be found."
          },
          "409" : {
            "description" : "NiFi Registry was unable to complete the request because it assumes a server state that is not valid."
          }
        },
        "security" : [ {
          "Authorization" : [ ]
        } ],
        "x-access-policy" : {
          "resource" : "/buckets/{bucketId}",
          "action" : "write"
        }
      }

Swagger definition of endpoint AFTER changes:

"/buckets/{bucketId}/bundles/{bundleType}" : {
      "post" : {
        "tags" : [ "Swagger Resource" ],
        "summary" : "Create extension bundle version",
        "description" : "Creates a version of an extension bundle by uploading a binary artifact. If an extension bundle already exists in the given bucket with the same group id and artifact id as that of the bundle being uploaded, then it will be added as a new version to the existing bundle. If an extension bundle does not already exist in the given bucket with the same group id and artifact id, then a new extension bundle will be created and this version will be added to the new bundle. Client's may optionally supply a SHA-256 in hex format through the multi-part form field 'sha256'. If supplied, then this value will be compared against the SHA-256 computed by the server, and the bundle will be rejected if the values do not match. If not supplied, the bundle will be accepted, but will be marked to indicate that the client did not supply a SHA-256 during creation. \n\nNOTE: This endpoint is subject to change as NiFi Registry and its REST API evolve.",
        "operationId" : "createExtensionBundleVersion",
        "consumes" : [ "multipart/form-data" ],
        "produces" : [ "application/json" ],
        "parameters" : [ {
          "name" : "bucketId",
          "in" : "path",
          "description" : "The bucket identifier",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "bundleType",
          "in" : "path",
          "description" : "The type of the bundle",
          "required" : true,
          "type" : "string",
          "enum" : [ "nifi-nar", "minifi-cpp" ]
        }, {
          "name" : "file",
          "in" : "formData",
          "description" : "The binary content of the bundle file being uploaded.",
          "required" : true,
          "type" : "file"
        }, {
          "name" : "sha256",
          "in" : "formData",
          "description" : "Optional sha256 of the provided bundle",
          "required" : false,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/BundleVersion"
            }
          },
          "400" : {
            "description" : "NiFi Registry was unable to complete the request because it was invalid. The request should not be retried without modification."
          },
          "401" : {
            "description" : "Client could not be authenticated."
          },
          "403" : {
            "description" : "Client is not authorized to make this request."
          },
          "404" : {
            "description" : "The specified resource could not be found."
          },
          "409" : {
            "description" : "NiFi Registry was unable to complete the request because it assumes a server state that is not valid."
          }
        },
        "security" : [ {
          "Authorization" : [ ]
        } ],
        "x-access-policy" : {
          "resource" : "/buckets/{bucketId}",
          "action" : "write"
        }
      }

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 21

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

- [ ] Documentation formatting appears as expected in rendered files

@asfgit asfgit closed this in 33c8029 Oct 31, 2023
asfgit pushed a commit that referenced this pull request Oct 31, 2023
…orm fields

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #7961.
@pvillard31
Copy link
Contributor

Thanks @Hexoplon - merged to main and 1.x

@Hexoplon Hexoplon deleted the NIFI-12298 branch November 1, 2023 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants