You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Otto Fowler (Jira)" <ji...@apache.org> on 2020/11/29 05:30:00 UTC

[jira] [Created] (NIFI-8051) NIFI ApiOperations should define nicknames to generate unique swagger operationId

Otto Fowler created NIFI-8051:
---------------------------------

             Summary: NIFI ApiOperations should define nicknames to generate unique swagger operationId
                 Key: NIFI-8051
                 URL: https://issues.apache.org/jira/browse/NIFI-8051
             Project: Apache NiFi
          Issue Type: Bug
            Reporter: Otto Fowler


The swagger definitions that nifi produces have duplicate operationId's for many operations.
While the swagger implementation 'works' ( IE.  it can generate clients with all the correct operations ) it is not per the spec, where unique operationIds are required.

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#fixed-fields-5

Thus, tools that are written to the spec throw errors when trying to generate against the nifi api json, such as : 


{code:json}
 {
      "type": "DUPLICATE_OPERATIONID",
      "message": "Multiple OASs share operations with the same operationId 'getPropertyDescriptor'",
      "mitigation": "Ignore operation and maintain preexisting operation. The operation from the OAS 'NiFi Rest Api' will be ignored"
    },
    {
      "type": "DUPLICATE_OPERATIONID",
      "message": "Multiple OASs share operations with the same operationId 'updateRunStatus'",
      "mitigation": "Ignore operation and maintain preexisting operation. The operation from the OAS 'NiFi Rest Api' will be ignored"
    },
    {
      "type": "DUPLICATE_OPERATIONID",
      "message": "Multiple OASs share operations with the same operationId 'getState'",
      "mitigation": "Ignore operation and maintain preexisting operation. The operation from the OAS 'NiFi Rest Api' will be ignored"
    },
    {
      "type": "DUPLICATE_OPERATIONID",
      "message": "Multiple OASs share operations with the same operationId 'clearState'",
      "mitigation": "Ignore operation and maintain preexisting operation. The operation from the OAS 'NiFi Rest Api' will be ignored"
    },
    {
      "type": "MISSING_RESPONSE_SCHEMA",
      "message": "Operation DELETE /versions/active-requests/{id} has no (valid) response schema. You can use the fillEmptyResponses option to create a placeholder schema",
      "mitigation": "Ignore operation."
    },
    {
      "type": "DUPLICATE_OPERATIONID",
      "message": "Multiple OASs share operations with the same operationId 'deleteUpdateRequest'",
      "mitigation": "Ignore operation and maintain preexisting operation. The operation from the OAS 'NiFi Rest Api' will be ignored"
    }
{code}

the fix for this may be to define a "nickname", that would create a unique operationId, such as

{code:java}
@GET
    @Consumes(MediaType.WILDCARD)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{id}/state")
    @ApiOperation(
            nickname="processor_get_state"
            value = "Gets the state for a processor",
            response = ComponentStateEntity.class,
            authorizations = {
                    @Authorization(value = "Write - /processors/{uuid}")
            }
    )
{code}

to reproduce:
https://loopback.io/openapi-to-graphql.html against the nifi openapi json



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