@pipe0/openapi-proxy 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pipe0 GmbH (Schweiz)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,148 @@
1
- # Temporary Holding Version
1
+ # @pipe0/openapi-proxy
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Your backend generates one OpenAPI document for everything it does. Your public docs, your SDK generator and your partners should each get a part of it. This tool keeps the selection for each audience in one file in your repository, serves the filtered documents on localhost while you develop, and deploys them from CI to stable URLs at [openapi-proxy.app](https://openapi-proxy.app) or an instance of your own.
4
+
5
+ Every filtered document is a valid, self-contained OpenAPI document: the operations you chose and exactly the schemas, parameters, responses and security schemes they reference. It can merge the documents of several services into one API, and serves each result as JSON or YAML, in OpenAPI 3.0 or 3.1.
6
+
7
+ ## Try it in 30 seconds
8
+
9
+ ```sh
10
+ npx @pipe0/openapi-proxy init https://petstore3.swagger.io/api/v3/openapi.json
11
+ npx @pipe0/openapi-proxy dev
12
+ ```
13
+
14
+ The first command writes `openapi-proxy.yaml` for that document, with one variant called `public` that serves nothing yet. The project's slug in it comes from the document's title. The second command prints two addresses:
15
+
16
+ ```
17
+ openapi-proxy is serving openapi-proxy.yaml
18
+
19
+ http://localhost:7745/v/swagger-petstore-openapi-3-0/public.json
20
+
21
+ Edit the file in your browser: http://localhost:7745
22
+ ```
23
+
24
+ Open the second one, check the operations the variant should serve, and save. The first address now serves that selection. Point a tool at it:
25
+
26
+ ```sh
27
+ npx openapi-typescript http://localhost:7745/v/swagger-petstore-openapi-3-0/public.json -o ./api.types.ts
28
+ ```
29
+
30
+ Use your own document in place of the Petstore: a URL, or a file your build writes.
31
+
32
+ ## Is this for you
33
+
34
+ There are two ways to use openapi-proxy.
35
+
36
+ **From your repository.** What each audience gets is written in a file next to your code. You serve it on localhost while you work, and deploy it from CI.
37
+
38
+ **From a URL.** Your OpenAPI document is at a URL. The service reads it, keeps reading it, and you choose in the app what each audience gets.
39
+
40
+ This package is the first way. For the second you need nothing installed: connect the URL at [openapi-proxy.app](https://openapi-proxy.app). Both make the same thing, and a project that started in the app can be copied into a file later.
41
+
42
+ ## The file
43
+
44
+ ```yaml
45
+ # openapi-proxy.yaml
46
+ version: 1
47
+ project: bookshop # the first part of every URL: /v/bookshop/<variant>
48
+
49
+ sources:
50
+ - file: ./openapi.json # or url: https://api.example.com/openapi.json
51
+
52
+ variants:
53
+ public: # served at /v/bookshop/public.json
54
+ include:
55
+ tags: [Books, Orders]
56
+ exclude:
57
+ operations: [GET /orders/export]
58
+ internal: {} # no include: everything, also what the API adds later
59
+ ```
60
+
61
+ | Key | What it says |
62
+ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
63
+ | `version` | The version of this format. Always `1`. |
64
+ | `project` | The project's slug, and the first part of every URL it serves. |
65
+ | `name` | What the project is called in the app. |
66
+ | `instance` | The address of a self-hosted instance to deploy to. Left out: `https://openapi-proxy.app`. |
67
+ | `visibility` | `public` or `private`, for every variant that does not say itself. |
68
+ | `overrides` | `title`, `description` and `servers` for every variant, in place of the document's. |
69
+ | `sources` | The OpenAPI documents. Each has a `url` or a `file`. With several, each has a `name`, one sets `main` to `true`, and a `pathPrefix` mounts one under a path. On a `url`, `follow` set to `true` makes the service keep reading it between deploys. |
70
+ | `variants` | The documents served, by slug. Each can have a `name`, an `icon`, a `visibility`, `include` and `exclude` (each with `tags` and `operations`), and `overrides` of its own. |
71
+
72
+ An operation is its method and path, `GET /books/{id}`. A tag stands for every operation that carries it, also for ones your API adds later. `exclude` wins over `include`. A name the documents do not have is a warning, never an error, so a file can be deployed before the API it describes.
73
+
74
+ Every key, with examples: [the configuration reference](https://openapi-proxy.app/docs/configuration). Editors that read the first line of the file check it as you type:
75
+
76
+ ```yaml
77
+ # yaml-language-server: $schema=https://openapi-proxy.app/schema/definition.v1.json
78
+ ```
79
+
80
+ The schema of the installed version is also in the package, as `schema.json`.
81
+
82
+ ## Commands
83
+
84
+ | Command | What it does | Needs a key |
85
+ | ---------------------------------- | -------------------------------------------------------------- | ----------- |
86
+ | `openapi-proxy init <url or file>` | Writes a first `openapi-proxy.yaml` for a document | No |
87
+ | `openapi-proxy dev` | Serves the variants on localhost, with a page to edit the file | No |
88
+ | `openapi-proxy validate` | Checks the file, and its names against the documents | No |
89
+ | `openapi-proxy operations` | Lists the operations and tags of the documents | No |
90
+ | `openapi-proxy deploy` | Sends the file and its documents to the service | Yes |
91
+
92
+ - `--config <file>` names another file than `openapi-proxy.yaml`, on every command.
93
+ - `--source [name=]<location>` reads a source from somewhere else for this run, on `dev`, `validate` and `operations`. While you develop, that is your dev server: `openapi-proxy dev --source http://localhost:8080/openapi.json`.
94
+ - `--help` after a command shows its options.
95
+
96
+ Every option: [the CLI reference](https://openapi-proxy.app/docs/cli).
97
+
98
+ ## Deploy from CI
99
+
100
+ A deploy reads the sources where it runs and uploads them with the file. The project with the file's slug becomes what the file says: it is created if it is not there, and variants the file no longer lists are deleted.
101
+
102
+ ```yaml
103
+ # .github/workflows/openapi-proxy.yml
104
+ name: OpenAPI documents
105
+ on:
106
+ pull_request:
107
+ push:
108
+ branches: [main]
109
+
110
+ jobs:
111
+ openapi-proxy:
112
+ runs-on: ubuntu-latest
113
+ steps:
114
+ - uses: actions/checkout@v4
115
+ - uses: actions/setup-node@v4
116
+ with:
117
+ node-version: 24
118
+ - run: npx @pipe0/openapi-proxy validate
119
+ - if: github.event_name == 'push'
120
+ run: npx @pipe0/openapi-proxy deploy
121
+ env:
122
+ OPENAPI_PROXY_API_KEY: ${{ secrets.OPENAPI_PROXY_API_KEY }}
123
+ ```
124
+
125
+ Two things need a person, once: the owner of a workspace creates a deploy API key in the app (Workspace, then Deploy API keys), and stores it as the secret `OPENAPI_PROXY_API_KEY` of the pipeline. Such a key can deploy definition files and nothing else.
126
+
127
+ `openapi-proxy deploy --dry-run` says what a deploy would change, and changes nothing.
128
+
129
+ The whole setup, step by step: [In your repository](https://openapi-proxy.app/docs/in-your-repository).
130
+
131
+ ## What it does on your machine
132
+
133
+ - It has no dependencies and no install scripts. Installing it downloads this package and runs nothing.
134
+ - It sends nothing anywhere unasked: no telemetry, no update check. `deploy` is the only command that sends your documents somewhere, and it says where.
135
+ - `dev` reads the definition file and its sources on every request and keeps nothing in between. A source that cannot be read is an error that names it, never an older copy.
136
+ - `dev` writes one file: the definition file, when you save in its editor. A save changes the file where the selection changed and leaves the rest, comments included, as you wrote it. `--no-editor` serves the variants and writes nothing.
137
+ - `dev` listens on `127.0.0.1` and answers only requests addressed to this machine by name, so a page on another website cannot read your documents. `--host` and `--allowed-host` open it up for containers and tunnels, and it then says who can reach it.
138
+ - The deploy key is read from the environment, never from the file or a flag.
139
+
140
+ It needs Node 20 or later.
141
+
142
+ ## For agents
143
+
144
+ Every page of the docs is plain Markdown: [`/docs/in-your-repository.md`](https://openapi-proxy.app/docs/in-your-repository.md) is the guide for setting up a repository, and [`/llms.txt`](https://openapi-proxy.app/llms.txt) lists the rest.
145
+
146
+ ## License
147
+
148
+ MIT. What it bundles is listed with its licenses in `dist/THIRD-PARTY-NOTICES.txt` and `dist/editor/THIRD-PARTY-NOTICES.txt`. The service it deploys to has its source in [the same repository](https://github.com/pipe-0/openapi-proxy), under FSL-1.1-MIT, and can be self-hosted.
@@ -0,0 +1,75 @@
1
+ @pipe0/openapi-proxy includes the following packages. Each is used under its own license.
2
+
3
+ @hono/node-server 1.19.19 (MIT)
4
+ hono 4.13.19 (MIT)
5
+ yaml 2.9.1 (ISC)
6
+
7
+ ------------------------------------------------------------------------
8
+ @hono/node-server 1.19.19
9
+ License: MIT
10
+
11
+ MIT License
12
+
13
+ Copyright (c) 2022 - present, Yusuke Wada and Hono contributors
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+
33
+ ------------------------------------------------------------------------
34
+ hono 4.13.19
35
+ License: MIT
36
+
37
+ MIT License
38
+
39
+ Copyright (c) 2021 - present, Yusuke Wada and Hono contributors
40
+
41
+ Permission is hereby granted, free of charge, to any person obtaining a copy
42
+ of this software and associated documentation files (the "Software"), to deal
43
+ in the Software without restriction, including without limitation the rights
44
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45
+ copies of the Software, and to permit persons to whom the Software is
46
+ furnished to do so, subject to the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be included in all
49
+ copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57
+ SOFTWARE.
58
+
59
+ ------------------------------------------------------------------------
60
+ yaml 2.9.1
61
+ License: ISC
62
+
63
+ Copyright Eemeli Aro <eemeli@gmail.com>
64
+
65
+ Permission to use, copy, modify, and/or distribute this software for any purpose
66
+ with or without fee is hereby granted, provided that the above copyright notice
67
+ and this permission notice appear in all copies.
68
+
69
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
70
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
71
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
72
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
73
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
74
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
75
+ THIS SOFTWARE.