Skip to content

Commit 6bc402a

Browse files
Merge pull request #448 from openapi-ui/fix/default-response
fix: fix bug #445
2 parents fc28fce + 906346c commit 6bc402a

8 files changed

+12
-6
lines changed

.changeset/lemon-webs-write.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openapi-ts-request': patch
3+
---
4+
5+
fix: fix bug #445

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
openapi-ts-request.cache.json

openapi-ts-request.cache.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"用户": "user",
55
"宠物们": "pets",
66
"你好": "hello"
7-
}
7+
}

src/generator/serviceGenarator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ export default class ServiceGenerator {
10481048
const response: ResponseObject | undefined =
10491049
responses &&
10501050
this.resolveRefObject(
1051-
responses.default || responses['200'] || responses['201']
1051+
responses['200'] || responses['201'] || responses.default
10521052
);
10531053
const defaultResponse = {
10541054
mediaType: '*/*',

test/__snapshots__/common/小驼峰命名文件和请求函数.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ export async function userCreateWithListUsingPost({
682682
body: API.UserCreateWithListUsingPostBody;
683683
options?: { [key: string]: unknown };
684684
}) {
685-
return request<unknown>('/user/createWithList', {
685+
return request<API.User>('/user/createWithList', {
686686
method: 'POST',
687687
headers: {
688688
'Content-Type': 'application/json',

test/__snapshots__/common/支持 null 类型作为默认值.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ export async function userCreateWithListUsingPost({
682682
body: API.UserCreateWithListUsingPostBody;
683683
options?: { [key: string]: unknown };
684684
}) {
685-
return request<unknown>('/user/createWithList', {
685+
return request<API.User>('/user/createWithList', {
686686
method: 'POST',
687687
headers: {
688688
'Content-Type': 'application/json',

test/__snapshots__/common/正常命名文件和请求函数.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ export async function userCreateWithListUsingPost({
682682
body: API.UserCreateWithListUsingPostBody;
683683
options?: { [key: string]: unknown };
684684
}) {
685-
return request<unknown>('/user/createWithList', {
685+
return request<API.User>('/user/createWithList', {
686686
method: 'POST',
687687
headers: {
688688
'Content-Type': 'application/json',

test/__snapshots__/common/测试将中文 tag 名称翻译成英文 tag 名称.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ export async function userCreateWithListUsingPost({
660660
body: API.UserCreateWithListUsingPostBody;
661661
options?: { [key: string]: unknown };
662662
}) {
663-
return request<unknown>('/user/createWithList', {
663+
return request<API.User>('/user/createWithList', {
664664
method: 'POST',
665665
headers: {
666666
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)