Skip to content

Commit

Permalink
Merge pull request #44 from aspida/develop
Browse files Browse the repository at this point in the history
chore(release): 0.11.0
  • Loading branch information
solufa authored Sep 2, 2020
2 parents fe0983f + 029d9ca commit 7f10ba6
Show file tree
Hide file tree
Showing 114 changed files with 2,475 additions and 1,529 deletions.
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.11.0](https://github.com/aspida/openapi2aspida/compare/v0.10.1...v0.11.0) (2020-09-02)


### Features

* update [email protected] ([c3c9976](https://github.com/aspida/openapi2aspida/commit/c3c9976db1d06fb8b8e7e43fa765073a5d19ed00))

### [0.10.1](https://github.com/aspida/openapi2aspida/compare/v0.10.0...v0.10.1) (2020-08-27)


Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openapi2aspida",
"version": "0.10.1",
"version": "0.11.0",
"description": "Convert OpenAPI 3.0 or Swagger 2.0 definitions into aspida",
"author": "Solufa <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -37,9 +37,9 @@
"swagger"
],
"dependencies": {
"aspida": "^0.20.3",
"aspida": "^0.21.0",
"swagger-parser": "^10.0.1",
"swagger2openapi": "^6.2.3"
"swagger2openapi": "^7.0.0"
},
"eslintConfig": {
"env": {
Expand Down Expand Up @@ -90,12 +90,12 @@
]
},
"devDependencies": {
"@types/jest": "^26.0.10",
"@types/jest": "^26.0.13",
"@types/js-yaml": "^3.12.5",
"@types/minimist": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"eslint": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"eslint": "^7.8.1",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
Expand Down
48 changes: 29 additions & 19 deletions samples/externals/$api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
import { AspidaClient } from 'aspida'
import { AspidaClient, dataToURLString } from 'aspida'
import { Methods as Methods0 } from './users/_user_id@string/orders'
import { Methods as Methods1 } from './users/_user_id@string/orders/_order_id@string'
import { Methods as Methods2 } from './users/_user_id@string/orders/purchase/invoice'
Expand All @@ -10,17 +10,17 @@ import { Methods as Methods6 } from './users/_user_id@string/phone-numbers/_phon
import { Methods as Methods7 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/purchase/invoice'
import { Methods as Methods8 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/purchase/wallet'

const GET = 'GET'
const POST = 'POST'
const PATH0 = '/users'
const PATH1 = '/orders'
const PATH2 = '/orders/purchase/invoice'
const PATH3 = '/orders/purchase/wallet'
const PATH4 = '/orders/unsubscribe'
const PATH5 = '/orders/update/renew'
const PATH6 = '/phone-numbers'
const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
const prefix = (baseURL === undefined ? 'https://api.baikalplatform.com/product-management/v1' : baseURL).replace(/\/$/, '')
const PATH0 = '/users'
const PATH1 = '/orders'
const PATH2 = '/orders/purchase/invoice'
const PATH3 = '/orders/purchase/wallet'
const PATH4 = '/orders/unsubscribe'
const PATH5 = '/orders/update/renew'
const PATH6 = '/phone-numbers'
const GET = 'GET'
const POST = 'POST'

return {
users: {
Expand All @@ -36,41 +36,48 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
get: (option?: { config?: T }) =>
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, 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)
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}`
}
},
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(),
$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)
fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `${prefix0}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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)
fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `${prefix0}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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)
fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `${prefix0}${PATH4}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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)
fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `${prefix0}${PATH5}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
},
phone_numbers: {
_phone_number: (val2: string) => {
Expand All @@ -83,19 +90,22 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
post: (option: { body: Methods7['post']['reqBody'], config?: T }) =>
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix2}${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)
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix2}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${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(),
$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)
fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `${prefix2}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${PATH3}`
}
},
get: (option?: { config?: T }) =>
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix2}${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)
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix2}${PATH1}`, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${PATH1}`
}
}
}
Expand Down
48 changes: 29 additions & 19 deletions samples/externals/users/$api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
import { AspidaClient } from 'aspida'
import { AspidaClient, dataToURLString } from 'aspida'
import { Methods as Methods0 } from './_user_id@string/orders'
import { Methods as Methods1 } from './_user_id@string/orders/_order_id@string'
import { Methods as Methods2 } from './_user_id@string/orders/purchase/invoice'
Expand All @@ -10,17 +10,17 @@ import { Methods as Methods6 } from './_user_id@string/phone-numbers/_phone_numb
import { Methods as Methods7 } from './_user_id@string/phone-numbers/_phone_number@string/orders/purchase/invoice'
import { Methods as Methods8 } from './_user_id@string/phone-numbers/_phone_number@string/orders/purchase/wallet'

const GET = 'GET'
const POST = 'POST'
const PATH0 = '/users'
const PATH1 = '/orders'
const PATH2 = '/orders/purchase/invoice'
const PATH3 = '/orders/purchase/wallet'
const PATH4 = '/orders/unsubscribe'
const PATH5 = '/orders/update/renew'
const PATH6 = '/phone-numbers'
const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
const prefix = (baseURL === undefined ? 'https://api.baikalplatform.com/product-management/v1' : baseURL).replace(/\/$/, '')
const PATH0 = '/users'
const PATH1 = '/orders'
const PATH2 = '/orders/purchase/invoice'
const PATH3 = '/orders/purchase/wallet'
const PATH4 = '/orders/unsubscribe'
const PATH5 = '/orders/update/renew'
const PATH6 = '/phone-numbers'
const GET = 'GET'
const POST = 'POST'

return {
_user_id: (val0: string) => {
Expand All @@ -35,41 +35,48 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
get: (option?: { config?: T }) =>
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, 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)
fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, prefix1, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix1}`
}
},
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(),
$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)
fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `${prefix0}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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)
fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `${prefix0}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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)
fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `${prefix0}${PATH4}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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)
fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `${prefix0}${PATH5}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix0}${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(),
$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, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
},
phone_numbers: {
_phone_number: (val2: string) => {
Expand All @@ -82,19 +89,22 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
post: (option: { body: Methods7['post']['reqBody'], config?: T }) =>
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix2}${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)
fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `${prefix2}${PATH2}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${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(),
$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)
fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `${prefix2}${PATH3}`, POST, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${PATH3}`
}
},
get: (option?: { config?: T }) =>
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix2}${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)
fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `${prefix2}${PATH1}`, GET, option).json().then(r => r.body),
$path: () => `${prefix}${prefix2}${PATH1}`
}
}
}
Expand Down
Loading

0 comments on commit 7f10ba6

Please sign in to comment.