@gyeonghokim/bruno-to-openapi 0.0.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.
@@ -0,0 +1,35 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ release:
12
+ name: Release
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: write # to be able to publish a GitHub release
16
+ issues: write # to be able to comment on released issues
17
+ pull-requests: write # to be able to comment on released pull requests
18
+ id-token: write # to enable use of OIDC for trusted publishing and npm provenance
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: "lts/*"
28
+ - name: Install dependencies
29
+ run: npm clean-install
30
+ - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
31
+ run: npm audit signatures
32
+ - name: Release
33
+ env:
34
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35
+ run: npx semantic-release
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Gyeongho Kim
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,80 @@
1
+ # Bruno to OpenAPI
2
+
3
+ Convert Bruno collections to OpenAPI specifications with ease. This library provides a simple way to transform Bruno collection JSON files into standardized OpenAPI 3.x specifications.
4
+
5
+ ## Installation
6
+
7
+ Install the package using npm:
8
+
9
+ ```bash
10
+ npm install @gyeonghokim/bruno-to-openapi
11
+ ```
12
+
13
+ ## Get Started
14
+
15
+ Once installed, you can use the library to convert your Bruno collections to OpenAPI specifications. Below are examples showing how to export to both JSON and YAML formats.
16
+
17
+ ### JSON Export
18
+
19
+ ```javascript
20
+ import { convertBrunoToOpenAPI } from '@gyeonghokim/bruno-to-openapi';
21
+ import fs from 'fs';
22
+
23
+ // Load your Bruno collection JSON file
24
+ import brunoCollection from './path-to-your-bruno-collection.json';
25
+
26
+ // Convert Bruno collection to OpenAPI specification
27
+ const openApiSpec = convertBrunoToOpenAPI(brunoCollection);
28
+
29
+ // Save as JSON file
30
+ fs.writeFileSync('openapi-spec.json', JSON.stringify(openApiSpec, null, 2));
31
+ console.log('OpenAPI specification saved as openapi-spec.json');
32
+ ```
33
+
34
+ ### YAML Export
35
+
36
+ To export as YAML, you can use the `js-yaml` library along with this package:
37
+
38
+ ```bash
39
+ npm install js-yaml
40
+ ```
41
+
42
+ ```javascript
43
+ import { convertBrunoToOpenAPI } from '@gyeonghokim/bruno-to-openapi';
44
+ import yaml from 'js-yaml';
45
+ import fs from 'fs';
46
+
47
+ // Load your Bruno collection JSON file
48
+ import brunoCollection from './path-to-your-bruno-collection.json';
49
+
50
+ // Convert Bruno collection to OpenAPI specification
51
+ const openApiSpec = convertBrunoToOpenAPI(brunoCollection);
52
+
53
+ // Convert to YAML and save
54
+ const yamlString = yaml.dump(openApiSpec, { indent: 2 });
55
+ fs.writeFileSync('openapi-spec.yaml', yamlString);
56
+ console.log('OpenAPI specification saved as openapi-spec.yaml');
57
+ ```
58
+
59
+ ## Features
60
+
61
+ - Converts Bruno collections to OpenAPI 3.x specifications
62
+ - Supports all common HTTP methods and parameters
63
+ - Handles authentication configurations
64
+ - Preserves request/response examples
65
+ - Maintains folder structures as tags
66
+ - Supports both JSON and YAML output formats
67
+
68
+ ## API Reference
69
+
70
+ The library exports a single function:
71
+
72
+ - `convertBrunoToOpenAPI(brunoCollection)`: Takes a Bruno collection object and returns an OpenAPI specification object.
73
+
74
+ ## Contributing
75
+
76
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
77
+
78
+ ## License
79
+
80
+ This project is licensed under the MIT License.
package/biome.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.0.0/schema.json",
3
+ "linter": {
4
+ "enabled": true,
5
+ "rules": {
6
+ "recommended": true,
7
+ "complexity": {
8
+ "noStaticOnlyClass": "off"
9
+ }
10
+ }
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "asNeeded",
22
+ "arrowParentheses": "asNeeded"
23
+ }
24
+ },
25
+ "files": {
26
+ "include": ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
27
+ "ignore": [
28
+ "**/specs/**/*",
29
+ "**/tests/fixtures/**/*",
30
+ "**/node_modules/**/*",
31
+ "**/dist/**/*",
32
+ "**/build/**/*",
33
+ "**/*.json",
34
+ "**/*.md",
35
+ "**/*.yaml",
36
+ "**/*.yml"
37
+ ],
38
+ "ignoreUnknown": true
39
+ }
40
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@gyeonghokim/bruno-to-openapi",
3
+ "private": false,
4
+ "version": "0.0.0",
5
+ "description": "Convert Bruno API collections to OpenAPI 3.0 specification",
6
+ "type": "module",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "test": "vitest run",
18
+ "test:watch": "vitest",
19
+ "lint": "biome check .",
20
+ "lint:fix": "biome check --apply .",
21
+ "format": "biome format .",
22
+ "format:write": "biome format --write .",
23
+ "typecheck": "npm run typecheck:app && npm run typecheck:test",
24
+ "typecheck:app": "tsc --noEmit",
25
+ "typecheck:test": "tsc --noEmit -p tsconfig.test.json"
26
+ },
27
+ "keywords": [
28
+ "bruno",
29
+ "openapi",
30
+ "api",
31
+ "specification",
32
+ "converter"
33
+ ],
34
+ "author": "GyeongHo Kim",
35
+ "license": "MIT",
36
+ "devDependencies": {
37
+ "@apidevtools/swagger-parser": "^12.1.0",
38
+ "@biomejs/biome": "^1.0.0",
39
+ "@types/node": "^18.0.0",
40
+ "typescript": "^5.9.3",
41
+ "vitest": "^1.0.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ }
46
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "node",
6
+ "esModuleInterop": false,
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "skipLibCheck": true,
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "outDir": "./dist",
14
+ "rootDir": "./src",
15
+ "removeComments": false,
16
+ "noImplicitAny": true,
17
+ "strictNullChecks": true,
18
+ "strictFunctionTypes": true,
19
+ "noImplicitThis": true,
20
+ "noImplicitReturns": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "noUncheckedIndexedAccess": true,
23
+ "noImplicitOverride": true,
24
+ "useUnknownInCatchVariables": true,
25
+ "sourceMap": true,
26
+ "types": ["node"],
27
+ "verbatimModuleSyntax": true
28
+ },
29
+ "include": [
30
+ "src/**/*"
31
+ ],
32
+ "exclude": [
33
+ "node_modules",
34
+ "dist",
35
+ "tests"
36
+ ]
37
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": ".",
5
+ "types": ["node", "vitest/globals"]
6
+ },
7
+ "include": [
8
+ "src/**/*",
9
+ "tests/**/*"
10
+ ],
11
+ "exclude": [
12
+ "node_modules",
13
+ "dist"
14
+ ]
15
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from 'vitest/config'
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ include: ['tests/**/*.test.{ts,js}'],
6
+ exclude: ['node_modules', 'dist', 'tests/fixtures'],
7
+ environment: 'node',
8
+ tsconfig: './tsconfig.test.json',
9
+ globals: true,
10
+ coverage: {
11
+ provider: 'v8',
12
+ reporter: ['text', 'json', 'html'],
13
+ include: ['src/**/*'],
14
+ exclude: ['src/types/**/*', 'src/**/*.d.ts', 'src/index.ts'],
15
+ },
16
+ },
17
+ })