Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gridaco/postgrest-openapi
JS postgREST OpenAPI Spec parser
https://github.com/gridaco/postgrest-openapi
openapi parser postgresql postgrest schema swagger visualization
Last synced: 29 days ago
JSON representation
JS postgREST OpenAPI Spec parser
- Host: GitHub
- URL: https://github.com/gridaco/postgrest-openapi
- Owner: gridaco
- License: mit
- Created: 2024-10-10T03:27:14.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-10T03:44:51.000Z (3 months ago)
- Last Synced: 2024-12-13T12:16:06.193Z (about 1 month ago)
- Topics: openapi, parser, postgresql, postgrest, schema, swagger, visualization
- Language: TypeScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# postgrest-openapi
JS postgREST OpenAPI Spec parser.
A Library for parsing the openapi spec and re-constructing the relational graph and the column infos.
> This is not a request library, for making requests to a postgREST server, use [postgrest-js](https://github.com/supabase/postgrest-js)
### (WIP)
> This is a placeholder repo, we are working on exporting the related code as a package from [hrere](https://github.com/gridaco/grida/blob/main/apps/forms/lib/supabase-postgrest/parse.ts).
## Usage
```bash
npm install postgrest-openapi
yard add postgrest-openapi
pnpm add postgrest-openapi
```Fetching the OpenAPI spec from a postgREST server:
```ts
import { url } from "postgrest-openapi";
const json = await fetch(
url("https://xxxxxxxxxx.supabase.co/rest/v1", {
apiKey: "xxxxxxxxxx", // your anon key (anon key can fetch the spec just fine)
})
).then((res) => res.json());
```Parsing
```ts
import Parser from "postgrest-openapi";const parser = new Parser(json);
const definition = parser.define();
```