Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
Signed-off-by: adwait-godbole <adwaitngodbole@gmail.com>
  • Loading branch information
adwait-godbole committed Jan 31, 2025
1 parent 7597c22 commit a7cb7ea
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions frontend/src/lib/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ import Swagger from '@apidevtools/swagger-parser';
import { OpenAPIV2 } from 'openapi-types';
import { request } from './k8s/apiProxy';

let docsPromise: ReturnType<typeof getDocs>;

export async function getDocs() {
const docs = await request('/openapi/v2');
return Swagger.dereference(docs);
}

export async function getDocDefinitions(apiVersion: string, kind: string) {
docsPromise = getDocs(); // reset the cache each time for testing purposes

const { definitions = {} } = (await docsPromise) as OpenAPIV2.Document;
// We want a fresh call to getDocs() each time to ensure we get the latest mock data during testing
const { definitions = {} } = (await getDocs()) as OpenAPIV2.Document;

let [group, version] = apiVersion.split('/');
if (!version) {
Expand Down

0 comments on commit a7cb7ea

Please sign in to comment.