Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eiel/openapi3-flowtype-definition
https://github.com/eiel/openapi3-flowtype-definition
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/eiel/openapi3-flowtype-definition
- Owner: eiel
- License: mit
- Created: 2018-06-01T13:55:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-04T04:46:34.000Z (7 months ago)
- Last Synced: 2024-10-05T09:09:31.271Z (3 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAPI3-FlowType-definition
[![Build Status](https://travis-ci.com/eiel/openapi3-flowtype-definition.svg?branch=master)](https://travis-ci.com/eiel/openapi3-flowtype-definition)This repo contains [Flowtype](https://flow.org/) annotations for the [OpenAPI 3.0](https://swagger.io/specification/) JSON format.
Annotation is generatoed by [json-schema-to-flow-type](https://www.npmjs.com/package/json-schema-to-flow-type) from [OAI/OpenAPI-Specification #1236](https://github.com/OAI/OpenAPI-Specification/pull/1236)note: [OAI/OpenAPI-Specification #1270 - Alternative OAS3 JSON Schema](https://github.com/OAI/OpenAPI-Specification/pull/1270)
# install
```
npm install --save-dev openapi3-flowtype-definition
```or
```
yarn add --dev openapi3-flowtype-definition
```# Example
```
yarn init
yarn add -D babel-cli babel-preset-flow flow-bin
echo '{"presets": ["flow"]}' > .babelrc
``````javascript
// @flow
// index.js
import type { OpenAPI } from 'openapi3-flowtype-definition'const openAPI: OpenAPI = {
openapi: '3.0',
info: {
title: 'test',
version: '0.1',
},
paths: {},
}console.log(JSON.stringify(openAPI))
```you typecheck and generate json
```
yarn flow && babel-node index.js
```# Links
- [openapi-flowtype-definition](https://www.npmjs.com/package/openapi-flowtype-definition)
- Spported OpenAPI 2.0)