-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: init * chore: init * chore: init * chore: init * chore: init * chore: init * chore: init * chore: init * chore: init * chore: init
- Loading branch information
Showing
151 changed files
with
5,111 additions
and
9,378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ coverage | |
dist/ | ||
.idea/ | ||
temp/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
strict-peer-dependencies=false | ||
enable-pre-post-scripts=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
printWidth: 100, | ||
tabWidth: 2, | ||
useTabs: true, | ||
semi: true, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
bracketSpacing: true, | ||
arrowParens: 'always', | ||
overrides: [ | ||
{ | ||
files: ['*.yml', '*.yaml', '*.md', '*.toml', '*.json'], | ||
options: { | ||
tabWidth: 2, | ||
useTabs: false, | ||
}, | ||
}, | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,42 @@ | ||
# Swagger to TS | ||
# OpenAPI to TypeScript | ||
|
||
Command-line utilities for converting OpenAPI (formerly Swagger) definitions to TypeScript. | ||
Command-line utility for converting OpenAPI (formerly Swagger) definitions to TypeScript. | ||
|
||
## Installation | ||
|
||
WIP | ||
|
||
## Usage | ||
|
||
``` | ||
Usage: oa2ts <cmd> [args] | ||
Commands: | ||
oa2ts import Import OpenAPI specification and output TypeScript code | ||
Options: | ||
--version Show version number [boolean] | ||
--help Show help [boolean] | ||
``` | ||
|
||
### Available commands | ||
|
||
### import | ||
|
||
``` | ||
oa2ts import | ||
Import OpenAPI specification and output TypeScript code | ||
Options: | ||
--version Show version number [boolean] | ||
--help Show help [boolean] | ||
--file Path to OpenAPI spec file. Can be either a JSON or YAML file. | ||
[string] | ||
--url URL to remote OpenAPI spec file. [string] | ||
-o, --output Location for the output. [string] | ||
-c, --config Location for the config file. [string] | ||
--verbose Shows verbose output [boolean] | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Vivek Kumar Bansal | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# oa2ts CLI | ||
|
||
Package for the `oa2ts` CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#! /usr/bin/env node | ||
import '../dist/cli.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "@oa2ts/cli", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
"type": "module", | ||
"author": { | ||
"name": "Vivek Kumar Bansal", | ||
"email": "[email protected]" | ||
}, | ||
"bin": { | ||
"oa2ts": "./bin/oa2ts.js" | ||
}, | ||
"exports": { | ||
"./config": "./dist/config.js", | ||
"./plugin": "./dist/plugin.js", | ||
"./nameHelpers": "./dist/nameHelpers.js", | ||
"./pathHelpers": "./dist/pathHelpers.js", | ||
"./codegen": "./dist/codegen.js" | ||
}, | ||
"imports": { | ||
"#@oa2ts/cli/config": "./dist/config.js", | ||
"#@oa2ts/cli/plugin": "./dist/plugin.js" | ||
}, | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "tsc --outDir dist" | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0" | ||
}, | ||
"dependencies": { | ||
"chalk": "^5.0.1", | ||
"esbuild": "^0.15.5", | ||
"js-yaml": "^4.1.0", | ||
"node-fetch": "^3.2.10", | ||
"openapi3-ts": "^3.0.1", | ||
"pascal-case": "^3.1.2", | ||
"prettier": "^2.2.1", | ||
"swagger2openapi": "^7.0.5", | ||
"yargs": "^17.0.1", | ||
"yup": "^0.32.11" | ||
}, | ||
"devDependencies": { | ||
"@types/prettier": "^2.7.0", | ||
"@types/yargs": "^17.0.11", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.2.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import yargs from 'yargs'; | ||
import { hideBin } from 'yargs/helpers'; | ||
|
||
import { generateSpec } from './generateSpec.js'; | ||
import type { CLIConfig } from './config.js'; | ||
import { logError } from './helpers.js'; | ||
|
||
const NAME = 'oa2ts'; | ||
|
||
yargs(hideBin(process.argv)) | ||
.scriptName(NAME) | ||
.usage('Usage: $0 <cmd> [args]') | ||
.command( | ||
'import', | ||
'Import OpenAPI specification and output TypeScript code', | ||
(args) => { | ||
return args | ||
.option('file', { | ||
type: 'string', | ||
describe: 'Path to OpenAPI spec file. Can be either a JSON or YAML file.', | ||
}) | ||
.option('url', { | ||
type: 'string', | ||
describe: 'URL to remote OpenAPI spec file.', | ||
}) | ||
.option('output', { | ||
type: 'string', | ||
alias: 'o', | ||
describe: 'Location for the output.', | ||
}) | ||
.option('config', { | ||
type: 'string', | ||
alias: 'c', | ||
describe: 'Location for the config file.', | ||
}) | ||
.option('verbose', { | ||
type: 'boolean', | ||
describe: 'Shows verbose output', | ||
}) | ||
.conflicts('file', 'url') | ||
.check((argv) => { | ||
if (argv.config) return true; | ||
|
||
if (!argv.output) { | ||
throw new Error('Missing required argument: output'); | ||
} | ||
|
||
if (!argv.file && !argv.url) { | ||
throw new Error('Either "--file" or "--url" is required'); | ||
} | ||
|
||
return true; | ||
}); | ||
}, | ||
(argv) => { | ||
return generateSpec(argv as CLIConfig); | ||
}, | ||
) | ||
.help() | ||
.fail((msg, err) => { | ||
if (msg) { | ||
logError(msg); | ||
} | ||
|
||
if (err) { | ||
throw err; // preserve stack | ||
} | ||
|
||
process.exit(1); | ||
}) | ||
.demandCommand().argv; |
Oops, something went wrong.