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

[jira] [Updated] (NIFI-7498) Repeated operationId in swagger.json

     [ https://issues.apache.org/jira/browse/NIFI-7498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

endzeit updated NIFI-7498:
--------------------------
    Description: 
The swagger.json generated during the NiFi build process makes use of the parameter _operationId_. According to the [OpenAPI Specification version 2|https://swagger.io/docs/specification/2-0/paths-and-operations/] each "operation may specify a *unique* operationId". 

However the swagger.json generated by NiFi makes use of the same operationId multiple times - resulting in the CLI complaining about errors, see below.
h1. Affected endpoints:

Based on the error message, the following operationIds are used by multiple api paths:
{noformat}
getPropertyDescriptor
- /controller-services/{id}/descriptors
- /processors/{id}/descriptors
- /reporting-tasks/{id}/descriptors

getState
- /controller-services/{id}/state
- /processors/{id}/state
- /reporting-tasks/{id}/state
- /remote-process-groups/{id}/state

createControllerService
- /controller/controller-services
- /process-groups/{id}/controller-services

deleteUpdateRequest
- /parameter-contexts/{contextId}/update-requests/{requestId}
- /versions/update-requests/{id}

updateRunStatus
- /controller-services/{id}/run-status
- /input-ports/{id}/run-status
- /reporting-tasks/{id}/run-status
- /processors/{id}/run-status
- /output-ports/{id}/run-status

clearState
- /controller-services/{id}/state/clear-requests
- /reporting-tasks/{id}/state/clear-requests
- /processors/{id}/state/clear-requests{noformat}
h1. Steps to reproduce:

1. Build NiFi using the newest sources 
2. Use the openapi-generator CLI to generate a client based on the generated swagger.json
{code:java}
java -jar openapi-generator-cli.jar generate -i swagger.json -g kotlin
{code}
3. CLI fails with error message
{code:java}
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 13, Warning count: 0
Errors:
        -attribute paths.'/processors/{id}/descriptors'(get).operationId is repeated
        -attribute paths.'/input-ports/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/process-groups/{id}/controller-services'(post).operationId is repeated
        -attribute paths.'/processors/{id}/state'(get).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/state'(get).operationId is repeated
        -attribute paths.'/versions/update-requests/{id}'(delete).operationId is repeated
        -attribute paths.'/output-ports/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/remote-process-groups/{id}/state'(get).operationId is repeated
        -attribute paths.'/processors/{id}/state/clear-requests'(post).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/processors/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/state/clear-requests'(post).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/descriptors'(get).operationId is repeated        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:480)
        at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:507)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:423)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
{code}

  was:
The swagger.json generated during the NiFi build process makes use of the parameter _operationId_. According to the [OpenAPI Specification version 2|https://swagger.io/docs/specification/2-0/paths-and-operations/] each "operation may specify a *unique* operationId". 

However the swagger.json generated by NiFi makes use of the same operationId multiple times - resulting in the CLI complaining about errors, see below.
h1. Affected endpoints:

Based on the error message, the following operationIds are used by multiple api paths:
{noformat}
getPropertyDescriptor
- /controller-services/{id}/descriptors
- /processors/{id}/descriptors
- /reporting-tasks/{id}/descriptors

getState
- /controller-services/{id}/state
- /processors/{id}/state
- /reporting-tasks/{id}/state
- /remote-process-groups/{id}/state

createControllerService
- /controller/controller-services
- /process-groups/{id}/controller-services

deleteUpdateRequest
- /parameter-contexts/{contextId}/update-requests/{requestId}
- /versions/update-requests/{id}

updateRunStatus
- /controller-services/{id}/run-status
- /input-ports/{id}/run-status
- /reporting-tasks/{id}/run-status
- /processors/{id}/run-status
- /output-ports/{id}/run-status

clearState
- /controller-services/{id}/state/clear-requests
- /reporting-tasks/{id}/state/clear-requests
- /processors/{id}/state/clear-requests{noformat}
h1. Steps to reproduce:
 # Build NiFi using the newest sources
 # Use the openapi-generator CLI to generate a client based on the generated swagger.json 

{code:java}
java -jar openapi-generator-cli.jar generate -i swagger.json -g kotlin
{code}

 # CLI fails with error message

{code:java}
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 13, Warning count: 0
Errors:
        -attribute paths.'/processors/{id}/descriptors'(get).operationId is repeated
        -attribute paths.'/input-ports/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/process-groups/{id}/controller-services'(post).operationId is repeated
        -attribute paths.'/processors/{id}/state'(get).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/state'(get).operationId is repeated
        -attribute paths.'/versions/update-requests/{id}'(delete).operationId is repeated
        -attribute paths.'/output-ports/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/remote-process-groups/{id}/state'(get).operationId is repeated
        -attribute paths.'/processors/{id}/state/clear-requests'(post).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/processors/{id}/run-status'(put).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/state/clear-requests'(post).operationId is repeated
        -attribute paths.'/reporting-tasks/{id}/descriptors'(get).operationId is repeated        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:480)
        at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:507)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:423)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
{code}


> Repeated operationId in swagger.json
> ------------------------------------
>
>                 Key: NIFI-7498
>                 URL: https://issues.apache.org/jira/browse/NIFI-7498
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 1.11.4
>            Reporter: endzeit
>            Assignee: endzeit
>            Priority: Major
>
> The swagger.json generated during the NiFi build process makes use of the parameter _operationId_. According to the [OpenAPI Specification version 2|https://swagger.io/docs/specification/2-0/paths-and-operations/] each "operation may specify a *unique* operationId". 
> However the swagger.json generated by NiFi makes use of the same operationId multiple times - resulting in the CLI complaining about errors, see below.
> h1. Affected endpoints:
> Based on the error message, the following operationIds are used by multiple api paths:
> {noformat}
> getPropertyDescriptor
> - /controller-services/{id}/descriptors
> - /processors/{id}/descriptors
> - /reporting-tasks/{id}/descriptors
> getState
> - /controller-services/{id}/state
> - /processors/{id}/state
> - /reporting-tasks/{id}/state
> - /remote-process-groups/{id}/state
> createControllerService
> - /controller/controller-services
> - /process-groups/{id}/controller-services
> deleteUpdateRequest
> - /parameter-contexts/{contextId}/update-requests/{requestId}
> - /versions/update-requests/{id}
> updateRunStatus
> - /controller-services/{id}/run-status
> - /input-ports/{id}/run-status
> - /reporting-tasks/{id}/run-status
> - /processors/{id}/run-status
> - /output-ports/{id}/run-status
> clearState
> - /controller-services/{id}/state/clear-requests
> - /reporting-tasks/{id}/state/clear-requests
> - /processors/{id}/state/clear-requests{noformat}
> h1. Steps to reproduce:
> 1. Build NiFi using the newest sources 
> 2. Use the openapi-generator CLI to generate a client based on the generated swagger.json
> {code:java}
> java -jar openapi-generator-cli.jar generate -i swagger.json -g kotlin
> {code}
> 3. CLI fails with error message
> {code:java}
> Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
>  | Error count: 13, Warning count: 0
> Errors:
>         -attribute paths.'/processors/{id}/descriptors'(get).operationId is repeated
>         -attribute paths.'/input-ports/{id}/run-status'(put).operationId is repeated
>         -attribute paths.'/process-groups/{id}/controller-services'(post).operationId is repeated
>         -attribute paths.'/processors/{id}/state'(get).operationId is repeated
>         -attribute paths.'/reporting-tasks/{id}/state'(get).operationId is repeated
>         -attribute paths.'/versions/update-requests/{id}'(delete).operationId is repeated
>         -attribute paths.'/output-ports/{id}/run-status'(put).operationId is repeated
>         -attribute paths.'/remote-process-groups/{id}/state'(get).operationId is repeated
>         -attribute paths.'/processors/{id}/state/clear-requests'(post).operationId is repeated
>         -attribute paths.'/reporting-tasks/{id}/run-status'(put).operationId is repeated
>         -attribute paths.'/processors/{id}/run-status'(put).operationId is repeated
>         -attribute paths.'/reporting-tasks/{id}/state/clear-requests'(post).operationId is repeated
>         -attribute paths.'/reporting-tasks/{id}/descriptors'(get).operationId is repeated        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:480)
>         at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:507)
>         at org.openapitools.codegen.cmd.Generate.execute(Generate.java:423)
>         at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
>         at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
> {code}



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