@workos/openapi-spec 0.0.1

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.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 WorkOS
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 ADDED
@@ -0,0 +1,204 @@
1
+ # WorkOS OpenAPI Specification
2
+
3
+ This repository contains the [OpenAPI specification](https://github.com/OAI/OpenAPI-Specification) for the [WorkOS API](https://workos.com/docs/reference).
4
+
5
+ ## Overview
6
+
7
+ The WorkOS API provides a comprehensive platform for enterprise-ready features including:
8
+
9
+ - **User Management** - Authentication, identity, and user lifecycle management
10
+ - **Organization Management** - Multi-tenancy and organization-level configurations
11
+ - **Directory Sync** - Automated user provisioning with SCIM and directory providers
12
+ - **Single Sign-On (SSO)** - SAML and OIDC identity provider integrations
13
+ - **Audit Logs** - Comprehensive event logging and exports
14
+ - **API Keys** - Programmatic access management
15
+ - **Authorization** - Role-based access control (RBAC) and permissions
16
+
17
+ ## Specification
18
+
19
+ - **OpenAPI Version:** 3.1.1
20
+ - **Format:** YAML
21
+ - **File:** [`spec/open-api-spec.yaml`](spec/open-api-spec.yaml)
22
+
23
+ ## SDK Generation
24
+
25
+ This repository is the canonical source for SDK generation. The consumer config at `oagen.config.ts` defines spec interpretation policy (operation hints, mount rules, transforms) and imports the plugin bundle from `@workos/oagen-emitters`.
26
+
27
+ ### Orchestration scripts
28
+
29
+ All SDK orchestration runs from this project.
30
+
31
+ ```bash
32
+ # Resolve operation names and review the naming table
33
+ npm run sdk:resolve
34
+
35
+ # Generate SDK code
36
+ npm run sdk:generate -- --lang python --output ~/workos/sdks/backend/python
37
+
38
+ # Diff the current spec against the last-generated snapshot
39
+ npm run sdk:diff -- --lang python
40
+
41
+ # Run smoke tests and compat checks against generated output
42
+ npm run sdk:verify -- --lang python
43
+
44
+ # Extract a live SDK's public API surface for compat overlay
45
+ npm run sdk:extract -- --lang python
46
+ ```
47
+
48
+ ### Compat workflow
49
+
50
+ Check for breaking changes between a live SDK and freshly generated output.
51
+
52
+ ```bash
53
+ # 1. Extract baseline snapshot from the live SDK
54
+ npm run sdk:compat-extract -- --lang python --sdk-root ~/workos/sdks/backend/python
55
+
56
+ # 2. Generate new SDK code
57
+ npm run sdk:generate -- --lang python --output .oagen/python/sdk
58
+
59
+ # 3. Extract candidate snapshot from the generated output
60
+ npm run sdk:compat-extract -- --lang python --sdk-root .oagen/python/sdk --output .oagen/python/sdk
61
+
62
+ # 4. Diff baseline vs candidate (exits non-zero on breaking changes)
63
+ npm run sdk:compat-diff -- --lang python
64
+
65
+ # 5. Generate a markdown summary from the diff report
66
+ npm run sdk:compat-summary -- --report .oagen/python/compat-report.json
67
+
68
+ # Cross-language rollup
69
+ npm run sdk:compat-summary -- --report .oagen/python/compat-report.json --report .oagen/go/compat-report.json
70
+
71
+ # Write summary to a file instead of stdout
72
+ npm run sdk:compat-summary -- --report .oagen/python/compat-report.json --output summary.md
73
+ ```
74
+
75
+ ### Local development
76
+
77
+ Install dependencies:
78
+
79
+ ```bash
80
+ npm ci
81
+ ```
82
+
83
+ Sanity check the config and spec wiring:
84
+
85
+ ```bash
86
+ npm run sdk:check
87
+ ```
88
+
89
+ Common local loop:
90
+
91
+ ```bash
92
+ # Review resolved operation names and mounts
93
+ npm run sdk:resolve
94
+
95
+ # Generate one SDK locally
96
+ npm run sdk:generate -- --lang python --output .oagen/python/sdk
97
+
98
+ # Verify generated output
99
+ npm run sdk:verify -- --lang python --output .oagen/python/sdk
100
+ ```
101
+
102
+ If you are developing `@workos/oagen` or `@workos/oagen-emitters` locally, link them into this repo:
103
+
104
+ ```bash
105
+ npm run dev:link
106
+ ```
107
+
108
+ Restore published package resolution:
109
+
110
+ ```bash
111
+ npm run dev:unlink
112
+ ```
113
+
114
+ To preview the SDK validation PR comment locally, generate compat artifacts and then render the markdown comment from the downloaded or local artifact layout:
115
+
116
+ ```bash
117
+ node scripts/sdk-compat-pr-comment.mjs \
118
+ --artifacts-root sdk-diagnostics \
119
+ --output sample.md
120
+ ```
121
+
122
+ ### Typical workflow
123
+
124
+ 1. Edit `spec/open-api-spec.yaml`
125
+ 2. Update `oagen.config.ts` if the change needs new hints, mount rules, or transforms
126
+ 3. `npm run sdk:resolve` to inspect naming
127
+ 4. `npm run sdk:generate -- --lang <lang> --output .oagen/<lang>/sdk` to generate
128
+ 5. `npm run sdk:verify -- --lang <lang> --output .oagen/<lang>/sdk` to verify
129
+
130
+ ## Grabbing from npm
131
+
132
+ The spec is published to npm as [`@workos/openapi-spec`](https://www.npmjs.com/package/@workos/openapi-spec).
133
+
134
+ ```bash
135
+ npm install @workos/openapi-spec
136
+ ```
137
+
138
+ ### Usage
139
+
140
+ The package ships TypeScript types generated from the spec, plus the raw `open-api-spec.yaml` file.
141
+
142
+ **TypeScript types:**
143
+
144
+ ```ts
145
+ import type { paths, components, operations } from "@workos/openapi-spec";
146
+
147
+ type User = components["schemas"]["User"];
148
+
149
+ type CreateUserRequest =
150
+ paths["/user_management/users"]["post"]["requestBody"]["content"]["application/json"];
151
+
152
+ type CreateUserResponse =
153
+ paths["/user_management/users"]["post"]["responses"]["201"]["content"]["application/json"];
154
+
155
+ // Annotate HTTP client responses with the generated types:
156
+ const res = await fetch("https://api.workos.com/user_management/users/user_123");
157
+ const user: components["schemas"]["User"] = await res.json();
158
+ ```
159
+
160
+ The types follow the [`openapi-typescript`](https://openapi-ts.dev) layout: top-level `paths`, `components`, and `operations` interfaces.
161
+
162
+ **Loading the raw spec (Node.js, ESM):**
163
+
164
+ ```ts
165
+ import { readFileSync } from "node:fs";
166
+ import { createRequire } from "node:module";
167
+ import yaml from "js-yaml";
168
+
169
+ const require = createRequire(import.meta.url);
170
+ const specPath = require.resolve("@workos/openapi-spec/spec");
171
+ const spec = yaml.load(readFileSync(specPath, "utf8"));
172
+
173
+ console.log(spec.info.title, spec.info.version);
174
+ ```
175
+
176
+ **Loading the raw spec (Node.js, CommonJS):**
177
+
178
+ ```js
179
+ const { readFileSync } = require("node:fs");
180
+ const yaml = require("js-yaml");
181
+
182
+ const specPath = require.resolve("@workos/openapi-spec/spec");
183
+ const spec = yaml.load(readFileSync(specPath, "utf8"));
184
+ ```
185
+
186
+ **Bundlers (Vite, webpack, etc.) with a YAML loader:**
187
+
188
+ ```ts
189
+ import spec from "@workos/openapi-spec/spec";
190
+ ```
191
+
192
+ ## Generating Postman Collections
193
+
194
+ This repository includes scripts to generate Postman collections from the OpenAPI specification. See the `scripts/postman` folder for more information.
195
+
196
+ ## Support
197
+
198
+ - [WorkOS Documentation](https://workos.com/docs)
199
+ - [API Reference](https://workos.com/docs/reference)
200
+ - [Support](https://workos.com/support)
201
+
202
+ ## License
203
+
204
+ This OpenAPI specification is available under the [MIT License](LICENSE).