[
https://issues.apache.org/jira/browse/NIFI-7498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pierre Villard resolved NIFI-7498.
----------------------------------
Resolution: Feedback Received
Apache NiFi 1.x is no longer maintained and no new release is planned on the
1.x release line. Marking as resolved as part of a cleanup operation. Please
open a new one with an updated description if this is still relevant for NiFi
2.x.
> 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
> Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> 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}
>
> h1. Additional information:
> The plugin _com.github.kongchen:swagger-maven-plugin:3.1.5_ is used to
> generate the swagger.json file. It allows to define the format of the
> operationId by passing in a new _operationIdFormat_. The default is
> "<methodName>" - which is causing the problem described. However the plugin
> itself recommends using "<className>\_<methodName>\_<httpMethod>" as
> operationId - which would resolve the error caused by the duplicate usage.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)