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

Daniel Chaffelson updated NIFI-14850:
-------------------------------------
    Description: 
NiFi currently produces inconsistent Enums in the OpenAPI spec.

The correct standard is ["alice", "bob"], which is used in many parts of the 
spec.
However some areas now have ["alice, bob"], which is not correct, and 
occasionally duplicates like ["alice", "alice", "bob"], which is also not 
correct.

 

I note that these entries are mirrored in both the NiFi OpenAPI spec, and the 
Registry spec, suggesting some common underlying element.

1) Comma-joined single-string enums (syntactically valid but semantically wrong)
 - File: resources/client_gen/api_defs/nifi-2.5.0.json
  - loadBalanceCompression
    Lines ~28015-28023:
    "enum" : [ "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, 
COMPRESS_ATTRIBUTES_AND_CONTENT" ]
  - loadBalanceStrategy
    Lines ~28020-28023:
    "enum" : [ "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, 
SINGLE_NODE" ]
  - backoffMechanism (VersionedProcessor)
    Lines ~28778-28782:
    "enum" : [ "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ]
  - transportProtocol (Site-to-Site)
    Lines ~29058-29061:
    "enum" : [ "RAW, HTTP" ]

 - File: resources/client_gen/api_defs/registry-2.5.0.json
  - loadBalanceCompression
    Lines ~6140-6144:
    "enum" : [ "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, 
COMPRESS_ATTRIBUTES_AND_CONTENT" ]
  - loadBalanceStrategy
    Lines ~6145-6148:
    "enum" : [ "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, 
SINGLE_NODE" ]
  - backoffMechanism (VersionedProcessor)
    Lines ~6904-6907:
    "enum" : [ "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ]
  - transportProtocol (Site-to-Site)
    Lines ~7184-7187:
    "enum" : [ "RAW, HTTP" ]

Impact: Generators interpret each array element as a discrete allowed value. 
These entries collapse multiple intended values into a single invalid literal, 
causing generated clients to reject legitimate inputs at runtime.

2) Duplicate enum values (violates OAS 3.0.1 uniqueness requirement)
 - File: resources/client_gen/api_defs/nifi-2.5.0.json
  - Query param schema: includedRegistries
    Lines ~4698-4703:
    "items" : \{       "type" : "string",       "enum" : [ "NIFI", "JVM", 
"BULLETIN", "CONNECTION", "CLUSTER", "NIFI", "JVM", "BULLETIN", "CONNECTION", 
"CLUSTER" ]     }
  - lineageRequestType
    Lines ~20739-20743:
    "enum" : [ "PARENTS", "CHILDREN", "FLOWFILE", "PARENTS", "CHILDREN", 
"FLOWFILE" ]

 

  was:
NiFi currently produces inconsistent Enums in the OpenAPI spec.

The correct standard is ["alice", "bob"], which is used in many parts of the 
spec.
However some areas now have ["alice, bob"], which is not correct.

Furthermore, a few Enums have duplicate items, which is considered incorrect if 
we are doing housekeeping.

I note that these entries are mirrored in both the NiFi OpenAPI spec, and the 
Registry spec, suggesting some common underlying element.



1) Comma-joined single-string enums (syntactically valid but semantically wrong)
- File: resources/client_gen/api_defs/nifi-2.5.0.json
  - loadBalanceCompression
    Lines ~28015-28023:
    "enum" : [ "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, 
COMPRESS_ATTRIBUTES_AND_CONTENT" ]
  - loadBalanceStrategy
    Lines ~28020-28023:
    "enum" : [ "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, 
SINGLE_NODE" ]
  - backoffMechanism (VersionedProcessor)
    Lines ~28778-28782:
    "enum" : [ "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ]
  - transportProtocol (Site-to-Site)
    Lines ~29058-29061:
    "enum" : [ "RAW, HTTP" ]

- File: resources/client_gen/api_defs/registry-2.5.0.json
  - loadBalanceCompression
    Lines ~6140-6144:
    "enum" : [ "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, 
COMPRESS_ATTRIBUTES_AND_CONTENT" ]
  - loadBalanceStrategy
    Lines ~6145-6148:
    "enum" : [ "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, 
SINGLE_NODE" ]
  - backoffMechanism (VersionedProcessor)
    Lines ~6904-6907:
    "enum" : [ "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ]
  - transportProtocol (Site-to-Site)
    Lines ~7184-7187:
    "enum" : [ "RAW, HTTP" ]

Impact: Generators interpret each array element as a discrete allowed value. 
These entries collapse multiple intended values into a single invalid literal, 
causing generated clients to reject legitimate inputs at runtime.

2) Duplicate enum values (violates OAS 3.0.1 uniqueness requirement)
- File: resources/client_gen/api_defs/nifi-2.5.0.json
  - Query param schema: includedRegistries
    Lines ~4698-4703:
    "items" : {
      "type" : "string",
      "enum" : [ "NIFI", "JVM", "BULLETIN", "CONNECTION", "CLUSTER", "NIFI", 
"JVM", "BULLETIN", "CONNECTION", "CLUSTER" ]
    }
  - lineageRequestType
    Lines ~20739-20743:
    "enum" : [ "PARENTS", "CHILDREN", "FLOWFILE", "PARENTS", "CHILDREN", 
"FLOWFILE" ]

 


> OpenAPI Enum inconsistencies
> ----------------------------
>
>                 Key: NIFI-14850
>                 URL: https://issues.apache.org/jira/browse/NIFI-14850
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: NiFi API
>    Affects Versions: 2.5.0
>         Environment: N/A
>            Reporter: Daniel Chaffelson
>            Priority: Minor
>
> NiFi currently produces inconsistent Enums in the OpenAPI spec.
> The correct standard is ["alice", "bob"], which is used in many parts of the 
> spec.
> However some areas now have ["alice, bob"], which is not correct, and 
> occasionally duplicates like ["alice", "alice", "bob"], which is also not 
> correct.
>  
> I note that these entries are mirrored in both the NiFi OpenAPI spec, and the 
> Registry spec, suggesting some common underlying element.
> 1) Comma-joined single-string enums (syntactically valid but semantically 
> wrong)
>  - File: resources/client_gen/api_defs/nifi-2.5.0.json
>   - loadBalanceCompression
>     Lines ~28015-28023:
>     "enum" : [ "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, 
> COMPRESS_ATTRIBUTES_AND_CONTENT" ]
>   - loadBalanceStrategy
>     Lines ~28020-28023:
>     "enum" : [ "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, 
> SINGLE_NODE" ]
>   - backoffMechanism (VersionedProcessor)
>     Lines ~28778-28782:
>     "enum" : [ "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ]
>   - transportProtocol (Site-to-Site)
>     Lines ~29058-29061:
>     "enum" : [ "RAW, HTTP" ]
>  - File: resources/client_gen/api_defs/registry-2.5.0.json
>   - loadBalanceCompression
>     Lines ~6140-6144:
>     "enum" : [ "DO_NOT_COMPRESS, COMPRESS_ATTRIBUTES_ONLY, 
> COMPRESS_ATTRIBUTES_AND_CONTENT" ]
>   - loadBalanceStrategy
>     Lines ~6145-6148:
>     "enum" : [ "DO_NOT_LOAD_BALANCE, PARTITION_BY_ATTRIBUTE, ROUND_ROBIN, 
> SINGLE_NODE" ]
>   - backoffMechanism (VersionedProcessor)
>     Lines ~6904-6907:
>     "enum" : [ "PENALIZE_FLOWFILE, YIELD_PROCESSOR" ]
>   - transportProtocol (Site-to-Site)
>     Lines ~7184-7187:
>     "enum" : [ "RAW, HTTP" ]
> Impact: Generators interpret each array element as a discrete allowed value. 
> These entries collapse multiple intended values into a single invalid 
> literal, causing generated clients to reject legitimate inputs at runtime.
> 2) Duplicate enum values (violates OAS 3.0.1 uniqueness requirement)
>  - File: resources/client_gen/api_defs/nifi-2.5.0.json
>   - Query param schema: includedRegistries
>     Lines ~4698-4703:
>     "items" : \{       "type" : "string",       "enum" : [ "NIFI", "JVM", 
> "BULLETIN", "CONNECTION", "CLUSTER", "NIFI", "JVM", "BULLETIN", "CONNECTION", 
> "CLUSTER" ]     }
>   - lineageRequestType
>     Lines ~20739-20743:
>     "enum" : [ "PARENTS", "CHILDREN", "FLOWFILE", "PARENTS", "CHILDREN", 
> "FLOWFILE" ]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to