[SBI] Ignore unknown enum values and continue parsing (#2622) (#2649)

* [SBI] Ignore unknown enum values and continue parsing (#2622)

* [SBI] Reject empty enum lists (#2622)

Enum lists that are empty due to ignoring
unsupported enum values are also rejected.

* Revert changing `generator.sh`
This commit is contained in:
Brias 2023-10-26 15:44:51 +02:00 committed by GitHub
parent e3c2fd00d9
commit 3c6811a322
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 978 additions and 366 deletions

View file

@ -759,10 +759,15 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr
}
localEnum = OpenAPI_access_type_FromString(access_types_local->valuestring);
if (!localEnum) {
ogs_error("OpenAPI_access_type_FromString(access_types_local->valuestring) failed");
goto end;
ogs_info("Enum value \"%s\" for field \"access_types\" is not supported. Ignoring it ...",
access_types_local->valuestring);
} else {
OpenAPI_list_add(access_typesList, (void *)localEnum);
}
OpenAPI_list_add(access_typesList, (void *)localEnum);
}
if (access_typesList->count == 0) {
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed: Expected access_typesList to not be empty (after ignoring unsupported enum values).");
goto end;
}
}
@ -827,10 +832,15 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr
}
localEnum = OpenAPI_rat_type_FromString(rat_types_local->valuestring);
if (!localEnum) {
ogs_error("OpenAPI_rat_type_FromString(rat_types_local->valuestring) failed");
goto end;
ogs_info("Enum value \"%s\" for field \"rat_types\" is not supported. Ignoring it ...",
rat_types_local->valuestring);
} else {
OpenAPI_list_add(rat_typesList, (void *)localEnum);
}
OpenAPI_list_add(rat_typesList, (void *)localEnum);
}
if (rat_typesList->count == 0) {
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed: Expected rat_typesList to not be empty (after ignoring unsupported enum values).");
goto end;
}
}