Provisioning: Fix OpenAPI generation (#109513)
* post-process spec * update client * fix the openapi * revert playlist change * Fix unmanaged resource counts --------- Co-authored-by: Roberto Jimenez Sanchez <roberto.jimenez@grafana.com>
This commit is contained in:
co-authored by
Roberto Jimenez Sanchez
parent
2345da5100
commit
edcb6e6895
@@ -69,6 +69,11 @@ function processOpenAPISpec(spec: OpenAPIV3.Document) {
|
||||
const newSchemas: Record<string, unknown> = {};
|
||||
for (const schemaKey of Object.keys(newSpec.components.schemas)) {
|
||||
const newKey = simplifySchemaName(schemaKey);
|
||||
if (newSchemas[newKey]) {
|
||||
// This can happen when invalid specs are used, although ignoring the error will work
|
||||
// it is better to fix the spec to avoid confusion.
|
||||
throw new Error(`Duplicate schema key found: ${newKey}. from: ${schemaKey}`);
|
||||
}
|
||||
|
||||
const schemaObject = newSpec.components.schemas[schemaKey];
|
||||
updateRefs(schemaObject);
|
||||
|
||||
Reference in New Issue
Block a user