From 8ec8fb06b9554e9c42d569a08b512d0781478cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Wed, 19 Jun 2024 13:26:09 +0200 Subject: [PATCH 1/2] Fix parameter_sensitivities checking the values instead of the keys --- nipyapi/nifi/models/parameter_group_configuration_entity.py | 6 +++--- resources/client_gen/swagger_templates/model.mustache | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nipyapi/nifi/models/parameter_group_configuration_entity.py b/nipyapi/nifi/models/parameter_group_configuration_entity.py index 0bc603b8..3742baed 100644 --- a/nipyapi/nifi/models/parameter_group_configuration_entity.py +++ b/nipyapi/nifi/models/parameter_group_configuration_entity.py @@ -130,10 +130,10 @@ def parameter_sensitivities(self, parameter_sensitivities): :type: dict(str, str) """ allowed_values = ["SENSITIVE", "NON_SENSITIVE"] - if not set(parameter_sensitivities.keys()).issubset(set(allowed_values)): + if not set(parameter_sensitivities.values()).issubset(set(allowed_values)): raise ValueError( - "Invalid keys in `parameter_sensitivities` [{0}], must be a subset of [{1}]" - .format(", ".join(map(str, set(parameter_sensitivities.keys())-set(allowed_values))), + "Invalid values in `parameter_sensitivities` [{0}], must be a subset of [{1}]" + .format(", ".join(map(str, set(parameter_sensitivities.values())-set(allowed_values))), ", ".join(map(str, allowed_values))) ) diff --git a/resources/client_gen/swagger_templates/model.mustache b/resources/client_gen/swagger_templates/model.mustache index 308eeb80..484efca7 100644 --- a/resources/client_gen/swagger_templates/model.mustache +++ b/resources/client_gen/swagger_templates/model.mustache @@ -101,10 +101,10 @@ class {{classname}}(object): ) {{/isListContainer}} {{#isMapContainer}} - if not set({{{name}}}.keys()).issubset(set(allowed_values)): + if not set({{{name}}}.values()).issubset(set(allowed_values)): raise ValueError( - "Invalid keys in `{{{name}}}` [{0}], must be a subset of [{1}]" - .format(", ".join(map(str, set({{{name}}}.keys())-set(allowed_values))), + "Invalid values in `{{{name}}}` [{0}], must be a subset of [{1}]" + .format(", ".join(map(str, set({{{name}}}.values())-set(allowed_values))), ", ".join(map(str, allowed_values))) ) {{/isMapContainer}} From 88c720d416520018e54379223f5fb1fb87c2b76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Wed, 19 Jun 2024 17:01:01 +0200 Subject: [PATCH 2/2] Added None to allowed_values of parameter_sensitivities, since that's what NiFi returns when the value is not yet set --- nipyapi/nifi/models/parameter_group_configuration_entity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipyapi/nifi/models/parameter_group_configuration_entity.py b/nipyapi/nifi/models/parameter_group_configuration_entity.py index 3742baed..e06a86fe 100644 --- a/nipyapi/nifi/models/parameter_group_configuration_entity.py +++ b/nipyapi/nifi/models/parameter_group_configuration_entity.py @@ -129,7 +129,8 @@ def parameter_sensitivities(self, parameter_sensitivities): :param parameter_sensitivities: The parameter_sensitivities of this ParameterGroupConfigurationEntity. :type: dict(str, str) """ - allowed_values = ["SENSITIVE", "NON_SENSITIVE"] + # Added None, since that's what NiFi returns when the value is not yet set + allowed_values = ["SENSITIVE", "NON_SENSITIVE", None] if not set(parameter_sensitivities.values()).issubset(set(allowed_values)): raise ValueError( "Invalid values in `parameter_sensitivities` [{0}], must be a subset of [{1}]"