import type { OpenApi } from "../../types" ; export const getInferredType = ( schema ) : OpenApi . Schema | undefined => { if ( schema . type || schema . oneOf || schema . allOf || schema . anyOf ) { return schema ; } if ( schema . items ) { return { ... schema , type : "array" } ; } if ( schema . enum ) { return { ... schema , type : "string" } ; } if ( schema . properties ) { return { ... schema , type : "object" } ; } if ( schema . required ) { const properties = schema . required . reduce ( ( s , name ) => { return { ... s , [ name ] : { type : "any" } } ; } , { } ) ; return { ... schema , type : "object" , properties } ; } return undefined ; } ;