Skip to content

Commit

Permalink
fix: convert allOf/oneOf/anyOf
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Nov 7, 2020
1 parent c6f0c54 commit 7cccbfb
Show file tree
Hide file tree
Showing 72 changed files with 347 additions and 355 deletions.
2 changes: 1 addition & 1 deletion samples/externals/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$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),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
},
phone_numbers: {
_phone_number: (val2: string) => {
Expand Down
2 changes: 1 addition & 1 deletion samples/externals/users/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$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),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
},
phone_numbers: {
_phone_number: (val2: string) => {
Expand Down
100 changes: 50 additions & 50 deletions samples/freee/$api.ts

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions samples/freee/@types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1165,13 +1165,17 @@ export type forbiddenError = {
export type badRequestError = {
status_code?: number
errors?: {
messages: Partial<string[] & string>

type: 'status' | 'validation' | 'error'
}[]
}

export type badRequestNotFoundError = {
status_code?: number
errors?: {
messages: Partial<string[] & string>

type: 'status' | 'validation' | 'error'
}[]
}
Expand All @@ -1190,6 +1194,8 @@ export type tooManyRequestsError = {
export type internalServerError = {
status_code?: number
errors?: {
messages: Partial<string[] & string>

type: 'status' | 'validation' | 'error'
}[]
}
Expand Down
100 changes: 50 additions & 50 deletions samples/freee/api/$api.ts

Large diffs are not rendered by default.

100 changes: 50 additions & 50 deletions samples/freee/api/1/$api.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions samples/freee/api/1/account_items/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option: { query: Methods0['get']['query'], config?: T }) =>
Expand All @@ -41,7 +41,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option: { body: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
2 changes: 1 addition & 1 deletion samples/freee/api/1/banks/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$get: (option?: { query?: Methods0['get']['query'], config?: T }) =>
fetch<Methods0['get']['resBody'], BasicHeaders, Methods0['get']['status']>(prefix, PATH0, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
2 changes: 1 addition & 1 deletion samples/freee/api/1/companies/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) =>
fetch<Methods1['put']['resBody'], BasicHeaders, Methods1['put']['status']>(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option?: { config?: T }) =>
Expand Down
8 changes: 4 additions & 4 deletions samples/freee/api/1/deals/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods3['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods3['delete']['status']>(prefix, prefix1, DELETE, option).send().then(r => r.body),
$path: (option?: { method: 'delete'; query: Methods3['delete']['query'] }) =>
`${prefix}${prefix1}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
post: (option: { body: Methods2['post']['reqBody'], config?: T }) =>
Expand All @@ -59,7 +59,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods5['delete']['query'], config?: T }) =>
fetch<Methods5['delete']['resBody'], BasicHeaders, Methods5['delete']['status']>(prefix, prefix2, DELETE, option).json().then(r => r.body),
$path: (option?: { method: 'delete'; query: Methods5['delete']['query'] }) =>
`${prefix}${prefix2}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
post: (option: { body: Methods4['post']['reqBody'], config?: T }) =>
Expand All @@ -81,7 +81,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option: { query: Methods0['get']['query'], config?: T }) =>
Expand All @@ -93,7 +93,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option: { query: Methods0['get']['query'], config?: T }) =>
Expand All @@ -41,7 +41,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option: { body: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
4 changes: 2 additions & 2 deletions samples/freee/api/1/expense_applications/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option: { query: Methods0['get']['query'], config?: T }) =>
Expand All @@ -41,7 +41,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
2 changes: 1 addition & 1 deletion samples/freee/api/1/forms/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$get: (option: { query: Methods0['get']['query'], config?: T }) =>
fetch<Methods0['get']['resBody'], BasicHeaders, Methods0['get']['status']>(prefix, PATH0, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion samples/freee/api/1/forms/selectables/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$get: (option: { query: Methods0['get']['query'], config?: T }) =>
fetch<Methods0['get']['resBody'], BasicHeaders, Methods0['get']['status']>(prefix, PATH0, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
4 changes: 2 additions & 2 deletions samples/freee/api/1/invoices/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option: { query: Methods0['get']['query'], config?: T }) =>
Expand All @@ -41,7 +41,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
4 changes: 2 additions & 2 deletions samples/freee/api/1/items/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option: { query: Methods0['get']['query'], config?: T }) =>
Expand All @@ -41,7 +41,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
6 changes: 3 additions & 3 deletions samples/freee/api/1/journals/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$get: (option: { query: Methods1['get']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['get']['status']>(prefix, `${prefix0}${PATH2}`, GET, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) =>
`${prefix}${prefix0}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
},
status: {
get: (option: { query: Methods2['get']['query'], config?: T }) =>
fetch<Methods2['get']['resBody'], BasicHeaders, Methods2['get']['status']>(prefix, `${prefix0}${PATH3}`, GET, option).json(),
$get: (option: { query: Methods2['get']['query'], config?: T }) =>
fetch<Methods2['get']['resBody'], BasicHeaders, Methods2['get']['status']>(prefix, `${prefix0}${PATH3}`, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) =>
`${prefix}${prefix0}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}
}
Expand All @@ -42,7 +42,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$get: (option: { query: Methods0['get']['query'], config?: T }) =>
fetch<Methods0['get']['resBody'], BasicHeaders, Methods0['get']['status']>(prefix, PATH0, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
4 changes: 2 additions & 2 deletions samples/freee/api/1/journals/reports/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$get: (option: { query: Methods0['get']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods0['get']['status']>(prefix, `${prefix0}${PATH1}`, GET, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
},
status: {
get: (option: { query: Methods1['get']['query'], config?: T }) =>
fetch<Methods1['get']['resBody'], BasicHeaders, Methods1['get']['status']>(prefix, `${prefix0}${PATH2}`, GET, option).json(),
$get: (option: { query: Methods1['get']['query'], config?: T }) =>
fetch<Methods1['get']['resBody'], BasicHeaders, Methods1['get']['status']>(prefix, `${prefix0}${PATH2}`, GET, option).json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) =>
`${prefix}${prefix0}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions samples/freee/api/1/manual_journals/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
get: (option: { query: Methods0['get']['query'], config?: T }) =>
Expand All @@ -41,7 +41,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
4 changes: 2 additions & 2 deletions samples/freee/api/1/partners/$api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$delete: (option: { query: Methods1['delete']['query'], config?: T }) =>
fetch<void, BasicHeaders, Methods1['delete']['status']>(prefix, prefix0, DELETE, option).send().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) =>
`${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
},
code: {
Expand All @@ -56,7 +56,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
$post: (option: { body: Methods0['post']['reqBody'], config?: T }) =>
fetch<Methods0['post']['resBody'], BasicHeaders, Methods0['post']['status']>(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body),
$path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) =>
`${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}`
`${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}`
}
}

Expand Down
Loading

0 comments on commit 7cccbfb

Please sign in to comment.