Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aldotestino/notion-openapi
Create a Notion database from your OpenAPI document. Automatically map API endpoints, methods, and parameters into a structured Notion DB.
https://github.com/aldotestino/notion-openapi
api documentation generator notion openapi reference tool
Last synced: about 2 months ago
JSON representation
Create a Notion database from your OpenAPI document. Automatically map API endpoints, methods, and parameters into a structured Notion DB.
- Host: GitHub
- URL: https://github.com/aldotestino/notion-openapi
- Owner: aldotestino
- License: mit
- Created: 2024-10-08T12:56:12.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-08T18:54:44.000Z (3 months ago)
- Last Synced: 2024-10-31T05:42:05.072Z (2 months ago)
- Topics: api, documentation, generator, notion, openapi, reference, tool
- Language: TypeScript
- Homepage:
- Size: 153 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# notion-openapi
A utility to create Notion databases from an OpenAPI document. This package automatically generates a structured Notion database, mapping your API endpoints, methods, parameters, and descriptions directly from the OpenAPI spec. Perfect for documenting your API or sharing it with teams in a collaborative, visual format.
Features include:
- Supports OpenAPI 3.x
- Easy authentication with Notion API
- Auto-mapping of endpoints, methods, and parameters to Notion database properties## How to use
1. Create a page on Notion
2. Create a [Notion Integration](https://www.notion.so/profile/integrations) (leaving the default permissions is fine)
3. Get the Token associated with the integration
4. Connect the page to the integration
5. Install `notion-openapi`
```bash
npm install notion-openapi
# or
yarn install notion-openapi
# or
pnpm install notion-openapi
# or
bun add notion-openapi
```
6. Write some code
```ts
import { NotionOpenapi, getOpenapiFromURL } from 'notion-openapi';async function main() {
try {
const openapiUrl = ''; // URL of the openapi v3 JSON
const notionToken = ''; // notion token of the integration
const notionPageURL = ''; // URL of the notion page// Uses the same options of axios (headers for auth...)
const openapi = await getOpenapiFromURL(url);// Uses the same options of @notionhq/client
const notionOpenapi = new NotionOpenapi({
auth: notionToken
});const insertedEndpoints = await notionOpenapi.createDBFromOpeanpi({
openapi,
pageURL: notionPageURL
});console.log('Inserted endpoints:', insertedEndpoints);
} catch (error) {
console.error(error);
}
}main();
```