Skip to content

Commit

Permalink
chore(refactor): init
Browse files Browse the repository at this point in the history
- updated: improve code coherence
- updated: improve webpack+typescript setup, eslint
- updated: convert paw request to a valid openapi v3 document
- added: generate json schema based on request info (body, parameters, query)
- added: generate openapi response definition based on last httpExchange data
- refactor: parameter converters, moved to converter file instead

### TODO:

- [ ] [SecurityRequirementObject](https://swagger.io/specification/#security-scheme-object) type: `apiKey`, `http`
-  `apiKey` is not available in `Paw.Request` which is a key to evaluate whether 
items in a request parameters are security key/value.
- `http` is not available in `Paw.Request` as well, however, is it safe to assume `Authorization` header key
is a "Bearer" scheme?
  • Loading branch information
pongstr committed May 11, 2021
2 parents 3c9e317 + 2b313cb commit 3e6d7c3
Show file tree
Hide file tree
Showing 36 changed files with 4,130 additions and 3,592 deletions.
11 changes: 10 additions & 1 deletion .babelrc
@@ -1,6 +1,15 @@
{
"presets": [
"@babel/env",
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3,
"targets": {
"safari": "6"
}
}
],
"@babel/typescript"
],
"plugins": [
Expand Down
6 changes: 0 additions & 6 deletions .eslintrc.js

This file was deleted.

23 changes: 23 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,23 @@
{
"env": {
"node": true,
"jest": true,
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"prettier",
"eslint-config-airbnb-typescript-prettier"
],
"rules": {
"lines-between-class-members": [
"error",
"always",
{ "exceptAfterSingleLine": true }
]
},
"parser": "@typescript-eslint/parser",
"ignorePatterns": ["*.js", "./dist/*"]
}
205 changes: 201 additions & 4 deletions .gitignore
@@ -1,5 +1,202 @@
node_modules
dist
src/__index.ts
examples

# Created by https://www.toptal.com/developers/gitignore/api/macos,linux,windows,node
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,linux,windows,node

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.idea
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
.env*.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Storybook build outputs
.out
.storybook-out
storybook-static

# rollup.js default build output
dist/

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# Temporary folders
tmp/
temp/

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/macos,linux,windows,node
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
v14.16.0
7 changes: 7 additions & 0 deletions .prettierrc
@@ -0,0 +1,7 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
}
13 changes: 8 additions & 5 deletions jest.config.js
@@ -1,8 +1,11 @@
module.exports = {
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
preset: 'ts-jest',
clearMocks: true,
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
roots: ['<rootDir>/src'],
testEnvironment: 'node',
transform: {
'^.+\\.ts?$': 'ts-jest',
},
moduleDirectories: ['node_modules', 'src'],
}

0 comments on commit 3e6d7c3

Please sign in to comment.