Skip to content

Commit

Permalink
chore: add multiple file upload example
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonss0417 committed Jun 8, 2024
1 parent 7fd65db commit 6551662
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 16 deletions.
57 changes: 57 additions & 0 deletions examples/file-upload-download-example/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,63 @@
}
}
}
},
"/files/multiple-upload": {
"post": {
"operationId": "FileApiSpec_post_/multiple-upload",
"tags": [
"File"
],
"summary": "Upload Multiple Files",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"files": {
"items": {
"type": "string",
"format": "binary"
},
"type": "array"
}
},
"additionalProperties": false,
"required": [
"files"
]
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"fileNames": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"fileNames"
]
}
}
}
}
}
}
}
},
"components": {
Expand Down
2 changes: 1 addition & 1 deletion examples/file-upload-download-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"author": "Hyeonss",
"license": "MIT",
"dependencies": {
"tspec": "^0.1.108"
"tspec": "^0.1.114"
}
}
10 changes: 10 additions & 0 deletions examples/file-upload-download-example/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ export type FileApiSpec = Tspec.DefineApiSpec<{
},
},
},
'/multiple-upload': {
post: {
summary: 'Upload Multiple Files',
/** @mediaType multipart/form-data */
body: {
files: Tspec.BinaryStringArray;
},
responses: { 200: { fileNames: string[] } },
},
}
},
}>;

Expand Down
30 changes: 15 additions & 15 deletions examples/file-upload-download-example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -806,10 +806,10 @@ ts-node@^10.9.1:
v8-compile-cache-lib "^3.0.1"
yn "3.1.1"

tspec@^0.1.108:
version "0.1.108"
resolved "https://registry.yarnpkg.com/tspec/-/tspec-0.1.108.tgz#0eea77a0b1a203f3f97d799df1d114449713099f"
integrity sha512-VVwugw/FeM1ENlgLPr/bBEQ3X8GFrW4lM0DwDSuEkIkJs0V0MJWIlQSdlSBo+yx7tEdbT657GJyVWS6vGiM4OQ==
tspec@^0.1.114:
version "0.1.114"
resolved "https://registry.yarnpkg.com/tspec/-/tspec-0.1.114.tgz#f74120c40eda6d710510b7e3d9f89a9a21972df1"
integrity sha512-85m8beD+E09BX/B4vsf55X88f7SqdvRsvyteYE388Ek2fcirfIDfBGWc7oKkRJGjWIOGhbDawwr8IXWD/5kXDw==
dependencies:
debug "^4.3.4"
express "^4.18.2"
Expand All @@ -818,8 +818,8 @@ tspec@^0.1.108:
json-schema-to-openapi-schema "^0.4.0"
openapi-types "^12.0.2"
swagger-ui-express "^4.6.2"
typescript "~4.9.5"
typescript-json-schema "^0.57.0"
typescript "~5.1.0"
typescript-json-schema "^0.62.0"
yargs "^17.7.1"

type-is@~1.6.18:
Expand All @@ -830,24 +830,24 @@ type-is@~1.6.18:
media-typer "0.3.0"
mime-types "~2.1.24"

typescript-json-schema@^0.57.0:
version "0.57.0"
resolved "https://registry.yarnpkg.com/typescript-json-schema/-/typescript-json-schema-0.57.0.tgz#e87e16355ecf942762a7cea224e4f5bf6f65d1c9"
integrity sha512-xirQK0s95K3OL7Knve0OOxQHErByCxUsgXr5oCHa9J0jWgiA+9/tidHWPu1UMjRv7MoX5ViP6QmOrWCi+dvRew==
typescript-json-schema@^0.62.0:
version "0.62.0"
resolved "https://registry.yarnpkg.com/typescript-json-schema/-/typescript-json-schema-0.62.0.tgz#774b06b0c9d86d7f3580ea9136363a6eafae1470"
integrity sha512-qRO6pCgyjKJ230QYdOxDRpdQrBeeino4v5p2rYmSD72Jf4rD3O+cJcROv46sQukm46CLWoeusqvBgKpynEv25g==
dependencies:
"@types/json-schema" "^7.0.9"
"@types/node" "^16.9.2"
glob "^7.1.7"
path-equal "^1.2.5"
safe-stable-stringify "^2.2.0"
ts-node "^10.9.1"
typescript "~4.9.5"
typescript "~5.1.0"
yargs "^17.1.1"

typescript@~4.9.5:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
typescript@~5.1.0:
version "5.1.6"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==

[email protected], unpipe@~1.0.0:
version "1.0.0"
Expand Down

0 comments on commit 6551662

Please sign in to comment.