Skip to content

Commit

Permalink
fix: get response example return type (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
mskri authored Aug 23, 2023
1 parent e5e325e commit 2a170d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion __tests__/operation/get-response-examples.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { MediaTypeExample } from '../../src/lib/get-mediatype-examples';
import type * as RMOAS from '../../src/rmoas.types';

import { beforeAll, describe, test, expect, it } from 'vitest';
Expand Down Expand Up @@ -71,7 +72,7 @@ test('should do its best at handling circular schemas', async () => {
// offsetAfter: { id: 'string', rules: { transitions: [ undefined ] } },
// offsetBefore: { id: 'string', rules: { transitions: [ undefined ] } }
// }
expect((examples[0] as Record<string, RMOAS.MediaTypeObject>).mediaTypes['application/json']).toStrictEqual([
expect((examples[0] as Record<string, MediaTypeExample[]>).mediaTypes['application/json']).toStrictEqual([
{
value: {
dateTime: expect.any(String),
Expand Down
3 changes: 2 additions & 1 deletion src/operation/get-response-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import getMediaTypeExamples from '../lib/get-mediatype-examples';
import { isRef } from '../rmoas.types';

export type ResponseExamples = {
mediaTypes: Record<string, RMOAS.MediaTypeObject>;
mediaTypes: Record<string, MediaTypeExample[]>;
status: string;
onlyHeaders?: boolean;
}[];

/**
Expand Down

0 comments on commit 2a170d3

Please sign in to comment.