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

2020-11-30 Thread Otto Fowler (Jira)


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

Otto Fowler commented on NIFI-8051:
---

>From looking at this a little bit, fixing one will make the code get junk.  
>I'm sure that code gen is the main thing here.  It is unfortunate.  Maybe 
>there is a way to get both things correct IE> code gen the way it works now 
>but with operationID's unique and not used as the method names?

> 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
>Priority: Major
>
> 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)


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

2020-11-28 Thread Otto Fowler (Jira)


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

Otto Fowler commented on NIFI-8051:
---

Note:  I do not know if fixing this changes the generation in a way that 
regresses or breaks existing clients

> 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
>Priority: Major
>
> 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)