Skip to content

Commit

Permalink
Merge pull request #4 from aspidajs/develop
Browse files Browse the repository at this point in the history
chore(release): 0.9.0
  • Loading branch information
solufa authored Jun 26, 2020
2 parents 7458e9b + a2292e8 commit 14b5dbd
Show file tree
Hide file tree
Showing 231 changed files with 7,981 additions and 1,448 deletions.
19 changes: 0 additions & 19 deletions .dependabot/config.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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.9.0](https://github.com/aspidajs/openapi2aspida/compare/v0.8.0...v0.9.0) (2020-06-26)


### Features

* rename hoge.ts to hoge/index.ts ([0cd3fec](https://github.com/aspidajs/openapi2aspida/commit/0cd3fecf3964aabe97769719290645328c2d07e5))
* update [email protected] ([817d128](https://github.com/aspidajs/openapi2aspida/commit/817d12867611e98c73df9d87bf3ae2d3abfb7039))

## [0.8.0](https://github.com/aspidajs/openapi2aspida/compare/v0.7.1...v0.8.0) (2020-06-15)


Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 m-mitsuhide <m.mitsuhide@amatelus.com>
Copyright (c) 2020 Solufa <solufa2020@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Create config file in project root
```js
module.exports = {
input: "apis", // "input" of aspida is "output" for openapi2aspida
outputEachDir: true, // Generate $api.ts in each endpoint directory
openapi: { inputFile: "https://petstore.swagger.io/v2/swagger.json" } // Compatible with yaml/json of OpenAPI3.0/Swagger2.0
}
```
Expand Down
6 changes: 6 additions & 0 deletions aspida.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
module.exports = [
{
input: 'samples/swagger',
outputEachDir: true,
openapi: { inputFile: 'samples/swagger.yaml', mock: true }
},
{
input: 'samples/simple',
outputEachDir: true,
openapi: { inputFile: 'samples/simple.yaml', mock: true, noMockType: true }
},
{
input: 'samples/strapi',
outputEachDir: true,
openapi: { inputFile: 'samples/strapi.json' }
},
{
input: 'samples/freee',
outputEachDir: true,
openapi: { inputFile: 'samples/freee.json', mock: true }
},
{
input: 'samples/openapi',
outputEachDir: true,
openapi: { inputFile: 'samples/openapi.json', mock: true, yaml: false }
},
{
input: 'samples/externals',
outputEachDir: true,
openapi: { inputFile: 'samples/externals.json', yaml: false }
}
]
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "openapi2aspida",
"version": "0.8.0",
"version": "0.9.0",
"description": "Convert OpenAPI 3.0 or Swagger 2.0 definitions into aspida",
"author": "m-mitsuhide <m.mitsuhide@amatelus.com>",
"author": "Solufa <solufa2020@gmail.com>",
"license": "MIT",
"main": "dist/index.js",
"bin": "bin/index.js",
Expand Down Expand Up @@ -37,15 +37,15 @@
"swagger"
],
"dependencies": {
"aspida": "^0.18.0",
"aspida": "^0.19.2",
"swagger-parser": "^9.0.1",
"swagger2openapi": "^6.0.3"
},
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@types/jest": "^25.2.3",
"@types/js-yaml": "^3.12.4",
"@commitlint/cli": "^9.0.1",
"@commitlint/config-conventional": "^9.0.1",
"@types/jest": "^26.0.3",
"@types/js-yaml": "^3.12.5",
"@types/minimist": "^1.2.0",
"@typescript-eslint/eslint-plugin": "2.34.0",
"@typescript-eslint/parser": "^2.34.0",
Expand All @@ -55,7 +55,7 @@
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.5",
Expand Down
151 changes: 86 additions & 65 deletions samples/externals/$api.ts
Original file line number Diff line number Diff line change
@@ -1,86 +1,107 @@
/* eslint-disable */
import { AspidaClient } from 'aspida'
import { Methods as Methods0 } from './users/_user_id@string/orders/index'
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'
import { Methods as Methods3 } from './users/_user_id@string/orders/purchase/wallet'
import { Methods as Methods4 } from './users/_user_id@string/orders/unsubscribe'
import { Methods as Methods5 } from './users/_user_id@string/orders/update/renew'
import { Methods as Methods6 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/index'
import { Methods as Methods6 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders'
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 api = <T>(client: AspidaClient<T>) => {
const prefix = (client.baseURL === undefined ? 'https://api.baikalplatform.com/product-management/v1' : client.baseURL).replace(/\/$/, '')
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(/\/$/, '')

return {
users: {
_user_id: (val0: string) => ({
orders: {
_order_id: (val1: string) => ({
get: (option?: { config?: T }) =>
client.fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, `/users/${val0}/orders/${val1}`, 'GET', option).json(),
$get: async (option?: { config?: T }) =>
(await client.fetch<Methods1['get']['resBody'], Methods1['get']['resHeaders'], Methods1['get']['status']>(prefix, `/users/${val0}/orders/${val1}`, 'GET', option).json()).body
}),
purchase: {
invoice: {
post: (option: { body: Methods2['post']['reqBody'], config?: T }) =>
client.fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `/users/${val0}/orders/purchase/invoice`, 'POST', option).json(),
$post: async (option: { body: Methods2['post']['reqBody'], config?: T }) =>
(await client.fetch<Methods2['post']['resBody'], Methods2['post']['resHeaders'], Methods2['post']['status']>(prefix, `/users/${val0}/orders/purchase/invoice`, 'POST', option).json()).body
_user_id: (val0: string) => {
const prefix0 = `${PATH0}/${val0}`

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

return {
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)
}
},
wallet: {
post: (option: { body: Methods3['post']['reqBody'], config?: T }) =>
client.fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `/users/${val0}/orders/purchase/wallet`, 'POST', option).json(),
$post: async (option: { body: Methods3['post']['reqBody'], config?: T }) =>
(await client.fetch<Methods3['post']['resBody'], Methods3['post']['resHeaders'], Methods3['post']['status']>(prefix, `/users/${val0}/orders/purchase/wallet`, 'POST', option).json()).body
}
},
unsubscribe: {
post: (option: { body: Methods4['post']['reqBody'], config?: T }) =>
client.fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `/users/${val0}/orders/unsubscribe`, 'POST', option).json(),
$post: async (option: { body: Methods4['post']['reqBody'], config?: T }) =>
(await client.fetch<Methods4['post']['resBody'], Methods4['post']['resHeaders'], Methods4['post']['status']>(prefix, `/users/${val0}/orders/unsubscribe`, 'POST', option).json()).body
},
update: {
renew: {
post: (option: { body: Methods5['post']['reqBody'], config?: T }) =>
client.fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `/users/${val0}/orders/update/renew`, 'POST', option).json(),
$post: async (option: { body: Methods5['post']['reqBody'], config?: T }) =>
(await client.fetch<Methods5['post']['resBody'], Methods5['post']['resHeaders'], Methods5['post']['status']>(prefix, `/users/${val0}/orders/update/renew`, 'POST', option).json()).body
}
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)
},
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)
}
},
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)
},
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)
}
},
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)
},
get: (option?: { query?: Methods0['get']['query'], config?: T }) =>
client.fetch<Methods0['get']['resBody'], Methods0['get']['resHeaders'], Methods0['get']['status']>(prefix, `/users/${val0}/orders`, 'GET', option).json(),
$get: async (option?: { query?: Methods0['get']['query'], config?: T }) =>
(await client.fetch<Methods0['get']['resBody'], Methods0['get']['resHeaders'], Methods0['get']['status']>(prefix, `/users/${val0}/orders`, 'GET', option).json()).body
},
phone_numbers: {
_phone_number: (val2: string) => ({
orders: {
purchase: {
invoice: {
post: (option: { body: Methods7['post']['reqBody'], config?: T }) =>
client.fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/invoice`, 'POST', option).json(),
$post: async (option: { body: Methods7['post']['reqBody'], config?: T }) =>
(await client.fetch<Methods7['post']['resBody'], Methods7['post']['resHeaders'], Methods7['post']['status']>(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/invoice`, 'POST', option).json()).body
},
wallet: {
post: (option: { body: Methods8['post']['reqBody'], config?: T }) =>
client.fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/wallet`, 'POST', option).json(),
$post: async (option: { body: Methods8['post']['reqBody'], config?: T }) =>
(await client.fetch<Methods8['post']['resBody'], Methods8['post']['resHeaders'], Methods8['post']['status']>(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/wallet`, 'POST', option).json()).body
phone_numbers: {
_phone_number: (val2: string) => {
const prefix2 = `${prefix0}${PATH6}/${val2}`

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(),
$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)
},
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)
}
},
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)
}
},
get: (option?: { config?: T }) =>
client.fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `/users/${val0}/phone-numbers/${val2}/orders`, 'GET', option).json(),
$get: async (option?: { config?: T }) =>
(await client.fetch<Methods6['get']['resBody'], Methods6['get']['resHeaders'], Methods6['get']['status']>(prefix, `/users/${val0}/phone-numbers/${val2}/orders`, 'GET', option).json()).body
}
}
})
}
}
})
}
}
}
}
Expand Down
Loading

0 comments on commit 14b5dbd

Please sign in to comment.