Skip to content

Commit

Permalink
Merge pull request #101 from aspida/develop
Browse files Browse the repository at this point in the history
chore(release): 0.15.0
  • Loading branch information
solufa authored Jan 6, 2021
2 parents 3528342 + fc40060 commit c23eb75
Show file tree
Hide file tree
Showing 32 changed files with 1,704 additions and 1,623 deletions.
28 changes: 10 additions & 18 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Node.js CI

on: push
on: [push, pull_request]

jobs:
test:
Expand All @@ -19,17 +19,13 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: "node_modules"
key: ${{ runner.os }}-node-v${{ matrix.node-version }}-yarn-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
- run: yarn lint
if: matrix.os != 'windows-latest'
- run: yarn typecheck
Expand All @@ -48,19 +44,15 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"
node-version: 12
registry-url: "https://registry.npmjs.org"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: "node_modules"
key: ${{ runner.os }}-node-v12-yarn-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
- run: yarn build
- run: npm publish
env:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.15.0](https://github.com/aspida/openapi2aspida/compare/v0.14.0...v0.15.0) (2021-01-06)


### Features

* update [email protected] ([965f754](https://github.com/aspida/openapi2aspida/commit/965f754939ab5ae702154d3bbafddc31cddd24ab))

## [0.14.0](https://github.com/aspida/openapi2aspida/compare/v0.13.0...v0.14.0) (2020-11-25)


Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# OpenAPI / Swagger to aspida

<br />
<br />
<br />
<br />
<br />
<div align="center">
<img src="https://aspida.github.io/aspida/logos/svg/black.svg" alt="aspida" title="aspida" width="600" />
</div>
<br />
<br />
<br />
<img src="https://aspida.github.io/aspida/logos/png/logo.png" alt="aspida" title="aspida" />
<div align="center">
<a href="https://www.npmjs.com/package/openapi2aspida">
<img src="https://img.shields.io/npm/v/openapi2aspida" alt="npm version" />
</a>
<a href="https://www.npmjs.com/package/openapi2aspida">
<img src="https://img.shields.io/npm/dm/openapi2aspida" alt="npm download" />
</a>
<a href="https://github.com/aspida/openapi2aspida/actions?query=workflow%3A%22Node.js+CI%22">
<img src="https://github.com/aspida/openapi2aspida/workflows/Node.js%20CI/badge.svg" alt="Node.js CI" />
</a>
<a href="https://codecov.io/gh/aspida/aspida">
<img src="https://img.shields.io/codecov/c/github/aspida/openapi2aspida.svg" alt="Codecov" />
</a>
<a href="https://github.com/aspida/openapi2aspida/LICENSE">
<img src="https://img.shields.io/npm/l/openapi2aspida" alt="License" />
<a href="https://lgtm.com/projects/g/aspida/openapi2aspida/context:javascript">
<img src="https://img.shields.io/lgtm/grade/javascript/g/aspida/openapi2aspida.svg" alt="Language grade: JavaScript" />
</a>
</div>
<br />
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openapi2aspida",
"version": "0.14.0",
"version": "0.15.0",
"description": "Convert OpenAPI 3.0 or Swagger 2.0 definitions into aspida",
"author": "Solufa <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -85,30 +85,30 @@
]
},
"dependencies": {
"aspida": "^0.22.2",
"aspida": "^1.2.1",
"openapi-types": "^7.0.1",
"swagger-parser": "^10.0.2",
"swagger2openapi": "^7.0.4"
},
"devDependencies": {
"@types/jest": "^26.0.15",
"@types/jest": "^26.0.19",
"@types/js-yaml": "^3.12.5",
"@types/minimist": "^1.2.1",
"@typescript-eslint/eslint-plugin": "^4.8.2",
"@typescript-eslint/parser": "^4.8.2",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^7.1.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"jest": "^26.6.3",
"prettier": "^2.2.0",
"standard-version": "^9.0.0",
"prettier": "^2.2.1",
"standard-version": "^9.1.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2"
"typescript": "^4.1.3"
}
}
66 changes: 33 additions & 33 deletions samples/externals/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,88 +24,88 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {

return {
users: {
_user_id: (val0: string) => {
const prefix0 = `${PATH0}/${val0}`
_user_id: (val1: string) => {
const prefix1 = `${PATH0}/${val1}`

return {
orders: {
_order_id: (val1: string) => {
const prefix1 = `${prefix0}${PATH1}/${val1}`
_order_id: (val3: string) => {
const prefix3 = `${prefix1}${PATH1}/${val3}`

return {
get: (option?: { config?: T }) =>
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, GET, option).json(),
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix3, GET, option).json(),
$get: (option?: { config?: T }) =>
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}`
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix3, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix3}`
}
},
purchase: {
invoice: {
post: (option: { body: Methods2['post']['reqBody'], config?: T }) =>
fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `${prefix0}${PATH2}`, POST, option).json(),
fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `${prefix1}${PATH2}`, POST, option).json(),
$post: (option: { body: Methods2['post']['reqBody'], config?: T }) =>
fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `${prefix0}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${PATH2}`
fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `${prefix1}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}${PATH2}`
},
wallet: {
post: (option: { body: Methods3['post']['reqBody'], config?: T }) =>
fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `${prefix0}${PATH3}`, POST, option).json(),
fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `${prefix1}${PATH3}`, POST, option).json(),
$post: (option: { body: Methods3['post']['reqBody'], config?: T }) =>
fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `${prefix0}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${PATH3}`
fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `${prefix1}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}${PATH3}`
}
},
unsubscribe: {
post: (option: { body: Methods4['post']['reqBody'], config?: T }) =>
fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `${prefix0}${PATH4}`, POST, option).json(),
fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `${prefix1}${PATH4}`, POST, option).json(),
$post: (option: { body: Methods4['post']['reqBody'], config?: T }) =>
fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `${prefix0}${PATH4}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${PATH4}`
fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `${prefix1}${PATH4}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}${PATH4}`
},
update: {
renew: {
post: (option: { body: Methods5['post']['reqBody'], config?: T }) =>
fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `${prefix0}${PATH5}`, POST, option).json(),
fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `${prefix1}${PATH5}`, POST, option).json(),
$post: (option: { body: Methods5['post']['reqBody'], config?: T }) =>
fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `${prefix0}${PATH5}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${PATH5}`
fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `${prefix1}${PATH5}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}${PATH5}`
}
},
get: (option?: { query?: Methods0['get']['query'], config?: T }) =>
fetch<Methods0['get']['resBody'], Methods0['get']['resHeaders'], Methods0['get']['status']>(prefix, `${prefix0}${PATH1}`, GET, option).json(),
fetch<Methods0['get']['resBody'], Methods0['get']['resHeaders'], Methods0['get']['status']>(prefix, `${prefix1}${PATH1}`, GET, option).json(),
$get: (option?: { query?: Methods0['get']['query'], config?: T }) =>
fetch<Methods0['get']['resBody'], Methods0['get']['resHeaders'], Methods0['get']['status']>(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body),
fetch<Methods0['get']['resBody'], Methods0['get']['resHeaders'], Methods0['get']['status']>(prefix, `${prefix1}${PATH1}`, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix1}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
},
phone_numbers: {
_phone_number: (val2: string) => {
const prefix2 = `${prefix0}${PATH6}/${val2}`
_phone_number: (val3: string) => {
const prefix3 = `${prefix1}${PATH6}/${val3}`

return {
orders: {
purchase: {
invoice: {
post: (option: { body: Methods7['post']['reqBody'], config?: T }) =>
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix2}${PATH2}`, POST, option).json(),
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix3}${PATH2}`, POST, option).json(),
$post: (option: { body: Methods7['post']['reqBody'], config?: T }) =>
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix2}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${PATH2}`
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix3}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix3}${PATH2}`
},
wallet: {
post: (option: { body: Methods8['post']['reqBody'], config?: T }) =>
fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `${prefix2}${PATH3}`, POST, option).json(),
fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `${prefix3}${PATH3}`, POST, option).json(),
$post: (option: { body: Methods8['post']['reqBody'], config?: T }) =>
fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `${prefix2}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${PATH3}`
fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `${prefix3}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix3}${PATH3}`
}
},
get: (option?: { config?: T }) =>
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix2}${PATH1}`, GET, option).json(),
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix3}${PATH1}`, GET, option).json(),
$get: (option?: { config?: T }) =>
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix2}${PATH1}`, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${PATH1}`
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix3}${PATH1}`, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix3}${PATH1}`
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions samples/externals/users/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {

return {
orders: {
_order_id: (val1: string) => {
const prefix1 = `${prefix0}${PATH1}/${val1}`
_order_id: (val2: string) => {
const prefix2 = `${prefix0}${PATH1}/${val2}`

return {
get: (option?: { config?: T }) =>
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, GET, option).json(),
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix2, GET, option).json(),
$get: (option?: { config?: T }) =>
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}`
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix2, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}`
}
},
purchase: {
Expand Down
Loading

0 comments on commit c23eb75

Please sign in to comment.