This repo contains Flowtype annotations for the OpenAPI 2.0 (or Swagger 2.0) JSON format. It uses exact object types for each specified OpenAPI object and doesn't allow vendor extensions.
npm i --save-dev openapi-flowtype-definition
or
yarn add --dev openapi-flowtype-definition
Assuming that your project is set up with Flowtype, import the type whenever you need to type check a JS object containing the OpenAPI definition:
import type { OpenAPI } from 'openapi-flowtype-definition';
const api: OpenAPI = {
swagger: "2.0",
// etc...
}
See the example under ./example
for more examples.