oas 16.0.2 → 17.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/@types/index.d.ts +155 -60
  2. package/@types/lib/find-schema-definition.d.ts +6 -1
  3. package/@types/lib/get-auth.d.ts +30 -17
  4. package/@types/lib/get-mediatype-examples.d.ts +22 -2
  5. package/@types/lib/get-schema.d.ts +21 -2
  6. package/@types/lib/get-user-variable.d.ts +11 -2
  7. package/@types/lib/matches-mimetype.d.ts +8 -5
  8. package/@types/operation/get-callback-examples.d.ts +19 -2
  9. package/@types/operation/get-parameters-as-json-schema.d.ts +1 -1
  10. package/@types/operation/get-requestbody-examples.d.ts +8 -3
  11. package/@types/operation/get-response-as-json-schema.d.ts +1 -1
  12. package/@types/operation/get-response-examples.d.ts +9 -4
  13. package/@types/operation.d.ts +140 -106
  14. package/@types/rmoas.types.d.ts +121 -0
  15. package/@types/samples/index.d.ts +24 -1
  16. package/@types/samples/utils.d.ts +12 -5
  17. package/@types/utils.d.ts +7 -6
  18. package/CHANGELOG.md +39 -0
  19. package/README.md +2 -1
  20. package/dist/index.js +221 -117
  21. package/dist/lib/find-schema-definition.js +5 -0
  22. package/dist/lib/get-auth.js +29 -7
  23. package/dist/lib/get-mediatype-examples.js +19 -10
  24. package/dist/lib/get-schema.js +34 -17
  25. package/dist/lib/get-user-variable.js +20 -9
  26. package/dist/lib/matches-mimetype.js +16 -9
  27. package/dist/lib/openapi-to-json-schema.js +5 -0
  28. package/dist/operation/get-callback-examples.js +21 -8
  29. package/dist/operation/get-parameters-as-json-schema.js +21 -15
  30. package/dist/operation/get-requestbody-examples.js +18 -8
  31. package/dist/operation/get-response-as-json-schema.js +19 -9
  32. package/dist/operation/get-response-examples.js +17 -6
  33. package/dist/operation.js +141 -110
  34. package/dist/rmoas.types.js +11 -0
  35. package/dist/samples/index.js +41 -31
  36. package/dist/samples/utils.js +28 -18
  37. package/package.json +11 -7
  38. package/src/{index.js → index.ts} +277 -127
  39. package/src/lib/find-schema-definition.ts +6 -1
  40. package/src/lib/get-auth.ts +41 -37
  41. package/src/lib/{get-mediatype-examples.js → get-mediatype-examples.ts} +21 -10
  42. package/src/lib/get-schema.ts +56 -0
  43. package/src/lib/get-user-variable.ts +24 -0
  44. package/src/lib/matches-mimetype.ts +48 -0
  45. package/src/lib/openapi-to-json-schema.js +5 -0
  46. package/src/operation/get-callback-examples.ts +47 -0
  47. package/src/operation/get-parameters-as-json-schema.js +21 -15
  48. package/src/operation/get-requestbody-examples.ts +39 -0
  49. package/src/operation/get-response-as-json-schema.js +20 -9
  50. package/src/operation/get-response-examples.ts +51 -0
  51. package/src/operation.ts +572 -0
  52. package/src/rmoas.types.ts +160 -0
  53. package/src/samples/{index.js → index.ts} +37 -24
  54. package/src/samples/{utils.js → utils.ts} +26 -21
  55. package/tsconfig.test.json +2 -1
  56. package/src/lib/get-schema.js +0 -32
  57. package/src/lib/get-user-variable.js +0 -18
  58. package/src/lib/matches-mimetype.js +0 -43
  59. package/src/operation/get-callback-examples.js +0 -30
  60. package/src/operation/get-requestbody-examples.js +0 -29
  61. package/src/operation/get-response-examples.js +0 -37
  62. package/src/operation.js +0 -474
package/@types/index.d.ts CHANGED
@@ -1,17 +1,93 @@
1
- export = Oas;
2
- declare class Oas {
3
- constructor(oas: any, user: any);
4
- user: any;
5
- _promises: any[];
6
- _dereferencing: {
1
+ import type * as RMOAS from './rmoas.types';
2
+ import type { MatchResult } from 'path-to-regexp';
3
+ import Operation, { Callback, Webhook } from './operation';
4
+ import utils from './utils';
5
+ declare type PathMatch = {
6
+ url: {
7
+ origin: string;
8
+ path: string;
9
+ nonNormalizedPath: string;
10
+ slugs: Record<string, string>;
11
+ method?: RMOAS.HttpMethods;
12
+ };
13
+ operation: RMOAS.PathsObject;
14
+ match?: MatchResult;
15
+ };
16
+ declare type PathMatches = Array<PathMatch>;
17
+ declare type Variables = Record<string, string | number | Array<{
18
+ default?: string | number;
19
+ }> | {
20
+ default?: string | number;
21
+ }>;
22
+ export default class Oas {
23
+ /**
24
+ * An OpenAPI API Definition.
25
+ */
26
+ api: RMOAS.OASDocument;
27
+ /**
28
+ * The current user that we should use when pulling auth tokens from security schemes.
29
+ */
30
+ user: RMOAS.User;
31
+ /**
32
+ * Internal storage array that the library utilizes to keep track of the times the {@see Oas.dereference} has been
33
+ * called so that if you initiate multiple promises they'll all end up returning the same data set once the initial
34
+ * dereference call completed.
35
+ *
36
+ * @todo These are always `Promise.resolve` and `Promise.reject`. Make these types more specific than `any`.
37
+ */
38
+ protected promises: Array<{
39
+ resolve: any;
40
+ reject: any;
41
+ }>;
42
+ /**
43
+ * Internal storage array that the library utilizes to keep track of its `dereferencing` state so it doesn't initiate
44
+ * multiple dereferencing processes.
45
+ */
46
+ protected dereferencing: {
7
47
  processing: boolean;
8
48
  complete: boolean;
9
49
  };
10
- getVersion(): any;
11
- url(selected: number, variables: any): any;
12
- variables(selected?: number): any;
13
- defaultVariables(selected?: number): {};
14
- splitUrl(selected?: number): any;
50
+ /**
51
+ * @param oas An OpenAPI definition.
52
+ * @param user The information about a user that we should use when pulling auth tokens from security schemes.
53
+ */
54
+ constructor(oas: RMOAS.OASDocument, user?: RMOAS.User);
55
+ /**
56
+ * This will initialize a new instance of the `Oas` class. This method is useful if you're using Typescript and are
57
+ * attempting to supply an untyped JSON object into `Oas` as it will force-type that object to an `OASDocument` for
58
+ * you.
59
+ *
60
+ * @param oas An OpenAPI definition.
61
+ * @param user The information about a user that we should use when pulling auth tokens from security schemes.
62
+ * @returns An instance of the Oas class.
63
+ */
64
+ static init(oas: Record<string, unknown> | RMOAS.OASDocument, user?: RMOAS.User): Oas;
65
+ /**
66
+ * @returns The OpenAPI version that this API definition is targeted for.
67
+ */
68
+ getVersion(): string;
69
+ /**
70
+ * @returns The current OpenAPI API Definition.
71
+ */
72
+ getDefinition(): RMOAS.OASDocument;
73
+ url(selected?: number, variables?: Variables): string;
74
+ variables(selected?: number): {
75
+ [variable: string]: import("openapi-types").OpenAPIV3.ServerVariableObject;
76
+ };
77
+ defaultVariables(selected?: number): Record<string, unknown>;
78
+ splitUrl(selected?: number): ({
79
+ type: string;
80
+ value: string;
81
+ key: string;
82
+ description?: undefined;
83
+ enum?: undefined;
84
+ } | {
85
+ type: string;
86
+ value: string;
87
+ key: string;
88
+ description: string;
89
+ enum: string[] | [string, ...string[]];
90
+ })[];
15
91
  /**
16
92
  * With a fully composed server URL, run through our list of known OAS servers and return back which server URL was
17
93
  * selected along with any contained server variables split out.
@@ -23,10 +99,13 @@ declare class Oas {
23
99
  *
24
100
  * Re-supplying this data to `oas.url()` should return the same URL you passed into this method.
25
101
  *
26
- * @param {String} baseUrl
27
- * @returns {Object|Boolean}
102
+ * @param baseUrl A given URL to extract server variables out of.
103
+ * @returns The extracted server variables and the configured server that they were matched to.
28
104
  */
29
- splitVariables(baseUrl: string): Object | boolean;
105
+ splitVariables(baseUrl: string): false | {
106
+ selected: number;
107
+ variables: Record<string, string | number>;
108
+ };
30
109
  /**
31
110
  * Replace templated variables with supplied data in a given URL.
32
111
  *
@@ -42,75 +121,80 @@ declare class Oas {
42
121
  * If no variables supplied match up with the template name, the template name will instead be used as the variable
43
122
  * data.
44
123
  *
45
- * @param {String} url
46
- * @param {Object} variables
47
- * @returns String
48
- */
49
- replaceUrl(url: string, variables?: Object): any;
50
- operation(path: any, method: any, opts?: {}): Operation.Webhook | Operation;
51
- findOperationMatches(url: any): {
52
- url: {
53
- origin: any;
54
- path: any;
55
- nonNormalizedPath: string;
56
- slugs: {};
57
- };
58
- operation: any;
59
- match: import("path-to-regexp").Match<object>;
60
- }[];
124
+ * @param url A URL to swap variables into.
125
+ * @param variables An object containing variables to swap into the URL.
126
+ * @returns The new URL with the variables.
127
+ */
128
+ replaceUrl(url: string, variables?: Variables): string;
129
+ /**
130
+ * Retrieve an Operation of Webhook class instance for a given path and method.
131
+ *
132
+ * @param path Path to lookup and retrieve.
133
+ * @param method HTTP Method to retrieve on the path.
134
+ * @param opts Options
135
+ * @param opts.isWebhook If you prefer to first look for a webhook with this path and method.
136
+ * @returns The found Operation or Webhook.
137
+ */
138
+ operation(path: string, method: RMOAS.HttpMethods, opts?: {
139
+ isWebhook?: boolean;
140
+ }): Operation;
141
+ findOperationMatches(url: string): PathMatches;
61
142
  /**
62
143
  * Discover an operation in an OAS from a fully-formed URL and HTTP method. Will return an object containing a `url`
63
144
  * object and another one for `operation`. This differs from `getOperation()` in that it does not return an instance
64
145
  * of the `Operation` class.
65
146
  *
66
- * @param {String} url
67
- * @param {String} method
68
- * @return {(Object|undefined)}
147
+ * @param url A full URL to look up.
148
+ * @param method The cooresponding HTTP method to look up.
149
+ * @returns An object containing matches that were discovered in the API definition.
69
150
  */
70
- findOperation(url: string, method: string): (Object | undefined);
151
+ findOperation(url: string, method: RMOAS.HttpMethods): PathMatch;
71
152
  /**
72
153
  * Discover an operation in an OAS from a fully-formed URL without an HTTP method. Will return an object containing a `url`
73
154
  * object and another one for `operation`.
74
155
  *
75
- * @param {String} url
76
- * @return {(Object|undefined)}
156
+ * @param url A full URL to look up.
157
+ * @returns An object containing matches that were discovered in the API definition.
77
158
  */
78
- findOperationWithoutMethod(url: string): (Object | undefined);
159
+ findOperationWithoutMethod(url: string): PathMatch;
79
160
  /**
80
161
  * Retrieve an operation in an OAS from a fully-formed URL and HTTP method. Differs from `findOperation` in that while
81
162
  * this method will return an `Operation` instance, `findOperation()` does not.
82
163
  *
83
- * @param {String} url
84
- * @param {String} method
85
- * @return {(Operation|undefined)}
164
+ * @param url A full URL to look up.
165
+ * @param method The cooresponding HTTP method to look up.
166
+ * @returns The found operation or webhook.
86
167
  */
87
- getOperation(url: string, method: string): (Operation | undefined);
168
+ getOperation(url: string, method: RMOAS.HttpMethods): Operation;
88
169
  /**
89
170
  * With an object of user information, retrieve an appropriate API key from the current OAS definition.
90
171
  *
91
172
  * @see {@link https://docs.readme.com/docs/passing-data-to-jwt}
92
- * @param {Object} user
93
- * @param {Boolean|String} selectedApp
173
+ * @param user User
174
+ * @param selectedApp The user app to retrieve an auth key for.
175
+ * @returns Found auth keys for the found security schemes.
94
176
  */
95
- getAuth(user: Object, selectedApp?: boolean | string): Record<string, unknown>;
177
+ getAuth(user: RMOAS.User, selectedApp?: string | number): {
178
+ [x: string]: unknown;
179
+ };
96
180
  /**
97
181
  * Returns the `paths` object that exists in this API definition but with every `method` mapped to an instance of
98
182
  * the `Operation` class.
99
183
  *
100
184
  * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#oasObject}
101
185
  * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}
102
- * @returns {object}
186
+ * @returns The Paths that exist on this API definition.
103
187
  */
104
- getPaths(): object;
188
+ getPaths(): Record<string, Record<RMOAS.HttpMethods, Operation | Webhook>>;
105
189
  /**
106
190
  * Returns the `webhooks` object that exists in this API definition but with every `method` mapped to an instance of
107
191
  * the `Operation` class.
108
192
  *
109
193
  * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#oasObject}
110
194
  * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}
111
- * @returns {object}
195
+ * @returns The Webhooks that exist on this API definition.
112
196
  */
113
- getWebhooks(): object;
197
+ getWebhooks(): Record<string, Record<RMOAS.HttpMethods, Webhook>>;
114
198
  /**
115
199
  * Return an array of all tag names that exist on this API definition.
116
200
  *
@@ -120,22 +204,33 @@ declare class Oas {
120
204
  * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}
121
205
  * @param {boolean} setIfMissing If a tag is not present on an operation that operations path will be added into the
122
206
  * list of tags returned.
123
- * @returns {array}
207
+ * @returns An array of tags.
208
+ */
209
+ getTags(setIfMissing?: boolean): unknown[];
210
+ /**
211
+ * Determine if a given a custom specification extension exists within the API definition.
212
+ *
213
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions}
214
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions}
215
+ * @param extension Specification extension to lookup.
216
+ * @returns The extension exists.
124
217
  */
125
- getTags(setIfMissing?: boolean): any;
218
+ hasExtension(extension: string): boolean;
219
+ /**
220
+ * Retrieve a custom specification extension off of the API definition.
221
+ *
222
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions}
223
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions}
224
+ * @param extension Specification extension to lookup.
225
+ * @returns The extension contents if it was found.
226
+ */
227
+ getExtension(extension: string): unknown;
126
228
  /**
127
229
  * Dereference the current OAS definition so it can be parsed free of worries of `$ref` schemas and circular
128
230
  * structures.
129
231
  *
130
- * @returns {Promise<void>}
232
+ * @returns A post-dereference Promise.
131
233
  */
132
- dereference(): Promise<void>;
133
- }
134
- declare namespace Oas {
135
- export { Operation, Callback, Webhook, utils };
234
+ dereference(): Promise<unknown>;
136
235
  }
137
- import Operation = require("./operation");
138
- import { Callback } from "./operation";
139
- import { Webhook } from "./operation";
140
- import utils_1 = require("./utils");
141
- import utils = utils_1.default;
236
+ export { Operation, Callback, Webhook, utils };
@@ -1 +1,6 @@
1
- export default function findSchemaDefinition($ref: string, definitions?: {}): false | any;
1
+ /**
2
+ * @param $ref Reference to look up a schema for.
3
+ * @param definitions OpenAPI definition to look for the `$ref` pointer in.
4
+ * @returns Found schema.
5
+ */
6
+ export default function findSchemaDefinition($ref: string, definitions?: {}): any;
@@ -1,19 +1,32 @@
1
- import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
2
- declare type primitiveType = string | number;
3
- declare type selectedAppType = primitiveType;
1
+ import type * as RMOAS from '../rmoas.types';
2
+ import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
4
3
  declare type authKey = null | unknown | {
5
- user: primitiveType;
6
- password: primitiveType;
4
+ user: string | number;
5
+ password: string | number;
7
6
  };
8
- interface User {
9
- [key: string]: unknown;
10
- keys?: Array<{
11
- name: string;
12
- user?: primitiveType;
13
- pass?: primitiveType;
14
- [key: string]: unknown;
15
- }>;
16
- }
17
- declare function getByScheme(user: User, scheme?: any, selectedApp?: selectedAppType): authKey;
18
- export { getByScheme };
19
- export default function getAuth(oas: OpenAPIV3.Document | OpenAPIV3_1.Document, user: User, selectedApp?: selectedAppType): Record<string, unknown>;
7
+ /**
8
+ * Retrieve auth keys for a specific security scheme for a given user for a specific "app" that they have configured.
9
+ *
10
+ * For `scheme` we're typing it to a union of `SecurityScheme` and `any` because we have handling and tests for an
11
+ * unknown or unrecognized `type` and though it's not possible with the `SecurityScheme.type` to be unrecognized it may
12
+ * still be possible to get an unrecognized scheme with this method in the wild as we have API definitions in our
13
+ * database that were ingested before we had good validation in place.
14
+ *
15
+ * @param user User
16
+ * @param scheme Security scheme to get auth keys for.
17
+ * @param selectedApp The user app to retrieve an auth key for.
18
+ * @returns The found auth key for this security scheme.
19
+ */
20
+ export declare function getByScheme(user: RMOAS.User, scheme?: RMOAS.KeyedSecuritySchemeObject, selectedApp?: string | number): authKey;
21
+ /**
22
+ * Retrieve auth keys for an API definition from a given user for a specific "app" that they have configured.
23
+ *
24
+ * @param api API definition
25
+ * @param user User
26
+ * @param selectedApp The user app to retrieve an auth key for.
27
+ * @returns Found auth keys for the found security schemes.
28
+ */
29
+ export default function getAuth(api: OpenAPIV3.Document | OpenAPIV3_1.Document, user: RMOAS.User, selectedApp?: string | number): {
30
+ [x: string]: unknown;
31
+ };
32
+ export {};
@@ -1,2 +1,22 @@
1
- declare function _exports(mediaType: string, mediaTypeObject: object, opts?: object): any;
2
- export = _exports;
1
+ import type * as RMOAS from '../rmoas.types';
2
+ export declare type MediaTypeExample = {
3
+ summary?: string;
4
+ title?: string;
5
+ description?: string;
6
+ value: unknown;
7
+ };
8
+ /**
9
+ * Extracts an array of examples from an OpenAPI Media Type Object. The example will either come from the `example`
10
+ * property, the first item in an `examples` array, or if none of those are present it will generate an example based
11
+ * off its schema.
12
+ *
13
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#mediaTypeObject}
14
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#mediaTypeObject}
15
+ * @param mediaType The media type that we're looking for examples for.
16
+ * @param mediaTypeObject The media type object that we're looking for examples for.
17
+ * @param opts Options
18
+ * @param opts.includeReadOnly If you wish to include data that's flagged as `readOnly`.
19
+ * @param opts.includeWriteOnly If you wish to include data that's flatted as `writeOnly`.
20
+ * @returns Array of media type examples.
21
+ */
22
+ export default function getMediaTypeExamples(mediaType: string, mediaTypeObject: RMOAS.MediaTypeObject, opts?: {}): MediaTypeExample[];
@@ -1,2 +1,21 @@
1
- declare function _exports(pathOperation: any, oas: any): any;
2
- export = _exports;
1
+ import type * as RMOAS from '../rmoas.types';
2
+ /**
3
+ * Gets the schema of the first media type defined in the `content` of the path operation or returns the ref if there's
4
+ * no Request Body Object.
5
+ *
6
+ * If the ref looks like a `requestBodies` reference, then do a lookup for the actual schema.
7
+ *
8
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#fixed-fields-8}
9
+ * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#fixed-fields-8}
10
+ * @param operation Operation to look for a primary requestBody schema in.
11
+ * @param api The API definition that this operation exists within.
12
+ * @returns The found requestBody schema.
13
+ */
14
+ export default function getSchema(operation: RMOAS.OperationObject, api?: RMOAS.OASDocument | {
15
+ [schemaType: string]: {
16
+ [key: string]: RMOAS.SchemaObject;
17
+ };
18
+ }): {
19
+ type: string;
20
+ schema: any;
21
+ };
@@ -1,2 +1,11 @@
1
- declare function _exports(user: any, property: any, selectedApp?: boolean): any;
2
- export = _exports;
1
+ import type * as RMOAS from '../rmoas.types';
2
+ /**
3
+ * Retrieve a user variable off of a given user.
4
+ *
5
+ * @see {@link https://docs.readme.com/docs/passing-data-to-jwt}
6
+ * @param user The user to get a user variable for.
7
+ * @param property The name of the variable to retrieve.
8
+ * @param selectedApp The user app to retrieve an auth key for.
9
+ * @returns Found user variable.
10
+ */
11
+ export default function getUserVariable(user: RMOAS.User, property: string, selectedApp?: string | number): unknown;
@@ -1,5 +1,8 @@
1
- export function formUrlEncoded(contentType: any): any;
2
- export function json(contentType: any): any;
3
- export function multipart(contentType: any): any;
4
- export function wildcard(contentType: any): boolean;
5
- export function xml(contentType: any): any;
1
+ declare const _default: {
2
+ formUrlEncoded: (mimeType: string) => boolean;
3
+ json: (contentType: string) => boolean;
4
+ multipart: (contentType: string) => boolean;
5
+ wildcard: (contentType: string) => boolean;
6
+ xml: (contentType: string) => boolean;
7
+ };
8
+ export default _default;
@@ -1,2 +1,19 @@
1
- declare function _exports(operation: object): any[];
2
- export = _exports;
1
+ import type * as RMOAS from '../rmoas.types';
2
+ export declare type CallbackExamples = {
3
+ identifier: string;
4
+ expression: string;
5
+ method: string;
6
+ example: unknown;
7
+ }[];
8
+ /**
9
+ * With an OpenAPI Operation Object return back an array of examples for any callbacks that may be present.
10
+ *
11
+ * @param operation Operation to retrieve callback examples from.
12
+ * @returns An an array of callback examples.
13
+ */
14
+ export default function getCallbackExamples(operation: RMOAS.OperationObject): {
15
+ identifier: string;
16
+ expression: string;
17
+ method: string;
18
+ example: unknown;
19
+ }[];
@@ -1,4 +1,4 @@
1
- declare function _exports(path: string, operation: any, oas: any, globalDefaults?: Object): any;
1
+ declare function _exports(path: string, operation: any, api: any, globalDefaults?: Object): any;
2
2
  declare namespace _exports {
3
3
  export { types };
4
4
  }
@@ -1,5 +1,10 @@
1
- declare function _exports(operation: object): (false | {
1
+ import type * as RMOAS from '../rmoas.types';
2
+ export declare type RequestBodyExamples = {
2
3
  mediaType: string;
3
4
  examples: any;
4
- })[];
5
- export = _exports;
5
+ }[];
6
+ /**
7
+ * @param operation Operation to retrieve requestBody examples for.
8
+ * @returns An object of response examples keyed by their media type.
9
+ */
10
+ export default function getRequestBodyExamples(operation: RMOAS.OperationObject): RequestBodyExamples;
@@ -1,4 +1,4 @@
1
- declare function _exports(operation: any, oas: any, statusCode: string): {
1
+ declare function _exports(operation: any, api: any, statusCode: any): {
2
2
  type: any;
3
3
  schema: any;
4
4
  label: string;
@@ -1,5 +1,10 @@
1
- declare function _exports(operation: object): (false | {
1
+ import type * as RMOAS from '../rmoas.types';
2
+ export declare type ResponseExamples = {
2
3
  status: string;
3
- mediaTypes: {};
4
- })[];
5
- export = _exports;
4
+ mediaTypes: Record<string, RMOAS.MediaTypeObject>;
5
+ }[];
6
+ /**
7
+ * @param operation Operation to retrieve response examples for.
8
+ * @returns An object of response examples keyed by their media type.
9
+ */
10
+ export default function getResponseExamples(operation: RMOAS.OperationObject): ResponseExamples;