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

Bug 1884613: Fix runtime error for basic users creating Prometheus instance #6821

Merged
merged 1 commit into from Oct 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion frontend/public/module/k8s/swagger.ts
Expand Up @@ -49,7 +49,13 @@ export const definitionFor = _.memoize((model: K8sKind): SwaggerDefinition => {
return null;
}
const key = getDefinitionKey(model, swaggerDefinitions);
return _.get(swaggerDefinitions, key);
// Some schemas might use $ref to reference an external schmema. In order for $ref to resolve,
// the referenced schema must be defined in the `definitions` property of the
// referencing schema.
return {
definitions: swaggerDefinitions,
...(swaggerDefinitions?.[key] ?? {}),
};
}, referenceForModel);

const getRef = (definition: SwaggerDefinition): string => {
Expand Down Expand Up @@ -118,6 +124,7 @@ export const getResourceDescription = _.memoize((kindObj: K8sKind): string => {
}, referenceForModel);

export type SwaggerDefinition = {
definitions?: SwaggerDefinitions;
description?: string;
type?: string;
enum?: string[];
Expand Down