[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

@ -242,10 +242,15 @@ OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJS
}
localEnum = OpenAPI_policy_decision_failure_code_FromString(pol_dec_failure_reports_local->valuestring);
if (!localEnum) {
ogs_error("OpenAPI_policy_decision_failure_code_FromString(pol_dec_failure_reports_local->valuestring) failed");
goto end;
ogs_info("Enum value \"%s\" for field \"pol_dec_failure_reports\" is not supported. Ignoring it ...",
pol_dec_failure_reports_local->valuestring);
} else {
OpenAPI_list_add(pol_dec_failure_reportsList, (void *)localEnum);
}
OpenAPI_list_add(pol_dec_failure_reportsList, (void *)localEnum);
}
if (pol_dec_failure_reportsList->count == 0) {
ogs_error("OpenAPI_error_report_parseFromJSON() failed: Expected pol_dec_failure_reportsList to not be empty (after ignoring unsupported enum values).");
goto end;
}
}