metadevpro / openapi3-ts

TS Model & utils for creating and exposing OpenAPI 3.x contracts.
MIT License
485 stars 64 forks source link

TS2305: Module "openapi3-ts" has no exported member SecurityRequirementObject #141

Open gustawdaniel opened 2 months ago

gustawdaniel commented 2 months ago

I trying

import {SecurityRequirementObject} from 'openapi3-ts'

but getting

TS2305: Module "openapi3-ts" has no exported member SecurityRequirementObject

I see this export here:

https://github.com/metadevpro/openapi3-ts/blob/master/src/model/openapi31.ts

currently i recreating this type locally

export type SecurityRequirementObject = {
  [key: string]: string[]
}
urugator commented 2 months ago

You have to specify oas version, either:

import { oas31 } from 'openapi3-ts';
oas31.SecurityRequirementObject 

or

import { SecurityRequirementObject  } from 'openapi3-ts/oas31';

see: https://github.com/metadevpro/openapi3-ts?tab=readme-ov-file#version-4