File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed
packages/react-openapi/src/models Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change 1- import { fromJSON , toJSON } from 'flatted' ;
2-
31import {
42 type Filesystem ,
53 type OpenAPIV3 ,
@@ -10,33 +8,18 @@ import {
108import { memoDereferenceFilesystem } from '../resolveOpenAPIOperation' ;
119import type { OpenAPIModelsData } from '../types' ;
1210
13- export { fromJSON , toJSON } ;
11+ //!!TODO: We should return only the models that are used in the block. Still a WIP awaiting future work.
1412
1513/**
1614 * Resolve an OpenAPI models from a file and compile it to a more usable format.
1715 * Models are extracted from the OpenAPI components.schemas
1816 */
1917export async function resolveOpenAPIModels (
2018 filesystem : Filesystem < OpenAPIV3xDocument >
21- // operationDescriptor: {
22- // path: string;
23- // method: string;
24- // }
2519) : Promise < OpenAPIModelsData | null > {
26- // const { path, method } = operationDescriptor;
2720 const schema = await memoDereferenceFilesystem ( filesystem ) ;
2821
29- if (
30- ! schema . components ||
31- ! schema . components . schemas ||
32- ! Object . keys ( schema . components . schemas ) . length
33- ) {
34- return null ;
35- }
36-
37- let models : OpenAPIModelsData [ 'models' ] = [ ] ;
38-
39- models = getOpenAPIComponents ( schema ) ;
22+ const models = getOpenAPIComponents ( schema ) ;
4023
4124 return { models } ;
4225}
You can’t perform that action at this time.
0 commit comments