Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat "null" as a valid value for a field of a JSON map #141

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions kubernetes/model/v1_certificate_signing_request_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,19 @@ v1_certificate_signing_request_spec_t *v1_certificate_signing_request_spec_parse
cJSON *extra = cJSON_GetObjectItemCaseSensitive(v1_certificate_signing_request_specJSON, "extra");
if (extra) {
cJSON *extra_local_map = NULL;
if(!cJSON_IsObject(extra)) {
if(!cJSON_IsObject(extra) && !cJSON_IsNull(extra))
{
goto end;//primitive map container
}
extraList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(extra_local_map, extra)
if(cJSON_IsObject(extra))
{
cJSON *localMapObject = extra_local_map;
list_addElement(extraList , localMapKeyPair);
extraList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(extra_local_map, extra)
{
cJSON *localMapObject = extra_local_map;
list_addElement(extraList , localMapKeyPair);
}
}
}

Expand Down
44 changes: 26 additions & 18 deletions kubernetes/model/v1_config_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,41 +181,49 @@ v1_config_map_t *v1_config_map_parseFromJSON(cJSON *v1_config_mapJSON){
cJSON *binary_data = cJSON_GetObjectItemCaseSensitive(v1_config_mapJSON, "binaryData");
if (binary_data) {
cJSON *binary_data_local_map = NULL;
if(!cJSON_IsObject(binary_data)) {
if(!cJSON_IsObject(binary_data) && !cJSON_IsNull(binary_data))
{
goto end;//primitive map container
}
binary_dataList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(binary_data_local_map, binary_data)
if(cJSON_IsObject(binary_data))
{
cJSON *localMapObject = binary_data_local_map;
if(!cJSON_IsString(localMapObject))
binary_dataList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(binary_data_local_map, binary_data)
{
goto end;
cJSON *localMapObject = binary_data_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(binary_dataList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(binary_dataList , localMapKeyPair);
}
}

// v1_config_map->data
cJSON *data = cJSON_GetObjectItemCaseSensitive(v1_config_mapJSON, "data");
if (data) {
cJSON *data_local_map = NULL;
if(!cJSON_IsObject(data)) {
if(!cJSON_IsObject(data) && !cJSON_IsNull(data))
{
goto end;//primitive map container
}
dataList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(data_local_map, data)
if(cJSON_IsObject(data))
{
cJSON *localMapObject = data_local_map;
if(!cJSON_IsString(localMapObject))
dataList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(data_local_map, data)
{
goto end;
cJSON *localMapObject = data_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(dataList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(dataList , localMapKeyPair);
}
}

Expand Down
22 changes: 13 additions & 9 deletions kubernetes/model/v1_csi_persistent_volume_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,24 @@ v1_csi_persistent_volume_source_t *v1_csi_persistent_volume_source_parseFromJSON
cJSON *volume_attributes = cJSON_GetObjectItemCaseSensitive(v1_csi_persistent_volume_sourceJSON, "volumeAttributes");
if (volume_attributes) {
cJSON *volume_attributes_local_map = NULL;
if(!cJSON_IsObject(volume_attributes)) {
if(!cJSON_IsObject(volume_attributes) && !cJSON_IsNull(volume_attributes))
{
goto end;//primitive map container
}
volume_attributesList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(volume_attributes_local_map, volume_attributes)
if(cJSON_IsObject(volume_attributes))
{
cJSON *localMapObject = volume_attributes_local_map;
if(!cJSON_IsString(localMapObject))
volume_attributesList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(volume_attributes_local_map, volume_attributes)
{
goto end;
cJSON *localMapObject = volume_attributes_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(volume_attributesList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(volume_attributesList , localMapKeyPair);
}
}

Expand Down
22 changes: 13 additions & 9 deletions kubernetes/model/v1_csi_volume_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,24 @@ v1_csi_volume_source_t *v1_csi_volume_source_parseFromJSON(cJSON *v1_csi_volume_
cJSON *volume_attributes = cJSON_GetObjectItemCaseSensitive(v1_csi_volume_sourceJSON, "volumeAttributes");
if (volume_attributes) {
cJSON *volume_attributes_local_map = NULL;
if(!cJSON_IsObject(volume_attributes)) {
if(!cJSON_IsObject(volume_attributes) && !cJSON_IsNull(volume_attributes))
{
goto end;//primitive map container
}
volume_attributesList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(volume_attributes_local_map, volume_attributes)
if(cJSON_IsObject(volume_attributes))
{
cJSON *localMapObject = volume_attributes_local_map;
if(!cJSON_IsString(localMapObject))
volume_attributesList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(volume_attributes_local_map, volume_attributes)
{
goto end;
cJSON *localMapObject = volume_attributes_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(volume_attributesList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(volume_attributesList , localMapKeyPair);
}
}

Expand Down
22 changes: 13 additions & 9 deletions kubernetes/model/v1_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,24 @@ v1_endpoint_t *v1_endpoint_parseFromJSON(cJSON *v1_endpointJSON){
cJSON *deprecated_topology = cJSON_GetObjectItemCaseSensitive(v1_endpointJSON, "deprecatedTopology");
if (deprecated_topology) {
cJSON *deprecated_topology_local_map = NULL;
if(!cJSON_IsObject(deprecated_topology)) {
if(!cJSON_IsObject(deprecated_topology) && !cJSON_IsNull(deprecated_topology))
{
goto end;//primitive map container
}
deprecated_topologyList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(deprecated_topology_local_map, deprecated_topology)
if(cJSON_IsObject(deprecated_topology))
{
cJSON *localMapObject = deprecated_topology_local_map;
if(!cJSON_IsString(localMapObject))
deprecated_topologyList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(deprecated_topology_local_map, deprecated_topology)
{
goto end;
cJSON *localMapObject = deprecated_topology_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(deprecated_topologyList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(deprecated_topologyList , localMapKeyPair);
}
}

Expand Down
22 changes: 13 additions & 9 deletions kubernetes/model/v1_flex_persistent_volume_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,24 @@ v1_flex_persistent_volume_source_t *v1_flex_persistent_volume_source_parseFromJS
cJSON *options = cJSON_GetObjectItemCaseSensitive(v1_flex_persistent_volume_sourceJSON, "options");
if (options) {
cJSON *options_local_map = NULL;
if(!cJSON_IsObject(options)) {
if(!cJSON_IsObject(options) && !cJSON_IsNull(options))
{
goto end;//primitive map container
}
optionsList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(options_local_map, options)
if(cJSON_IsObject(options))
{
cJSON *localMapObject = options_local_map;
if(!cJSON_IsString(localMapObject))
optionsList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(options_local_map, options)
{
goto end;
cJSON *localMapObject = options_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(optionsList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(optionsList , localMapKeyPair);
}
}

Expand Down
22 changes: 13 additions & 9 deletions kubernetes/model/v1_flex_volume_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,24 @@ v1_flex_volume_source_t *v1_flex_volume_source_parseFromJSON(cJSON *v1_flex_volu
cJSON *options = cJSON_GetObjectItemCaseSensitive(v1_flex_volume_sourceJSON, "options");
if (options) {
cJSON *options_local_map = NULL;
if(!cJSON_IsObject(options)) {
if(!cJSON_IsObject(options) && !cJSON_IsNull(options))
{
goto end;//primitive map container
}
optionsList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(options_local_map, options)
if(cJSON_IsObject(options))
{
cJSON *localMapObject = options_local_map;
if(!cJSON_IsString(localMapObject))
optionsList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(options_local_map, options)
{
goto end;
cJSON *localMapObject = options_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(optionsList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(optionsList , localMapKeyPair);
}
}

Expand Down
16 changes: 10 additions & 6 deletions kubernetes/model/v1_json_schema_props.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,15 +912,19 @@ v1_json_schema_props_t *v1_json_schema_props_parseFromJSON(cJSON *v1_json_schema
cJSON *dependencies = cJSON_GetObjectItemCaseSensitive(v1_json_schema_propsJSON, "dependencies");
if (dependencies) {
cJSON *dependencies_local_map = NULL;
if(!cJSON_IsObject(dependencies)) {
if(!cJSON_IsObject(dependencies) && !cJSON_IsNull(dependencies))
{
goto end;//primitive map container
}
dependenciesList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(dependencies_local_map, dependencies)
if(cJSON_IsObject(dependencies))
{
cJSON *localMapObject = dependencies_local_map;
list_addElement(dependenciesList , localMapKeyPair);
dependenciesList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(dependencies_local_map, dependencies)
{
cJSON *localMapObject = dependencies_local_map;
list_addElement(dependenciesList , localMapKeyPair);
}
}
}

Expand Down
22 changes: 13 additions & 9 deletions kubernetes/model/v1_label_selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,24 @@ v1_label_selector_t *v1_label_selector_parseFromJSON(cJSON *v1_label_selectorJSO
cJSON *match_labels = cJSON_GetObjectItemCaseSensitive(v1_label_selectorJSON, "matchLabels");
if (match_labels) {
cJSON *match_labels_local_map = NULL;
if(!cJSON_IsObject(match_labels)) {
if(!cJSON_IsObject(match_labels) && !cJSON_IsNull(match_labels))
{
goto end;//primitive map container
}
match_labelsList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(match_labels_local_map, match_labels)
if(cJSON_IsObject(match_labels))
{
cJSON *localMapObject = match_labels_local_map;
if(!cJSON_IsString(localMapObject))
match_labelsList = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach(match_labels_local_map, match_labels)
{
goto end;
cJSON *localMapObject = match_labels_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(match_labelsList , localMapKeyPair);
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(match_labelsList , localMapKeyPair);
}
}

Expand Down
Loading