メインコンテンツまでスキップ
バージョン: 0.14.0 (最新)

📐 ファイルストレージスキーマ

ファイルストレージは、署名付き画像および汎用ファイルのアップロード URL を生成するための OpenAPI クエリおよび操作スキーマをエクスポートします。

一覧

エクスポートリクエストの場所契約
contentLengthQueryParameterクエリ必須の整数バイト長。最大 10000000
getSignedImageUploadUrlSchemaクエリ / レスポンス画像 MIME タイプとコンテンツ長。200 の署名付き URL レスポンス。
getSignedFileUploadUrlSchemaクエリ / レスポンス安全な MIME タイプとコンテンツ長。200 の署名付き URL レスポンス。

詳細

contentLengthQueryParameter

定義
場所フィールド必須制約
クエリcontentLength整数はい最大 10000000 バイト(10 MB)。最小値は宣言されていません。

ルートでの使用: Indirectly by the routes composed from getSignedImageUploadUrlSchema, and by Organization's createChangeRequestRoute. 機能での使用: Indirectly by the features composed from getSignedImageUploadUrlSchema, and by Organization's createChangeRequestFeature through createChangeRequestSchema.

完全なソースを表示
export const contentLengthQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'contentLength',
required: true,
schema: {maximum: MAX_CONTENT_LENGTH, type: 'integer'},
};

getSignedImageUploadUrlSchema

定義
場所フィールド必須制約
クエリcontentType文字列はいEnum: image/jpeg, image/png, image/webp, image/gif, image/svg+xml, image/avif, image/bmp, image/x-icon, image/tiff, image/heif, image/heic.
クエリcontentLength整数はい最大 10000000 バイト。contentLengthQueryParameter から展開されます。
200 レスポンスobjectId文字列はいCloud Storage のオブジェクト名/キー。
200 レスポンスsignedUrl文字列(URI)はい事前署名済みストレージ URL。

200 レスポンスオブジェクトには additionalProperties: false が設定されています。

ルートでの使用: Profile's avatar-upload route, getLogoUploadUrlRoute, getCertificateUploadUrlRoute, getProductImageUploadUrlRoute, and getChatChannelIconUploadUrlRoute. 機能での使用: Profile's avatar-upload feature, getLogoUploadUrlFeature, getCertificateUploadUrlFeature, getProductImageUploadUrlFeature, and getChannelIconUploadUrlFeature.

完全なソースを表示
export const getSignedImageUploadUrlSchema = withSchema<OpenAPIOperation>({
parameters: [
{in: 'query', name: 'contentType', required: true, schema: {enum: IMAGE_MIME_TYPES, type: 'string'}},
{...contentLengthQueryParameter},
],
responses: {
'200': {
content: {
'application/json': {
schema: {
$schema: 'http://json-schema.org/draft-07/schema#',
additionalProperties: false,
properties: {
objectId: {description: 'Cloud Storage object name/key.', type: 'string'},
signedUrl: {description: 'Pre-signed URL to access the object', format: 'uri', type: 'string'},
},
required: ['objectId', 'signedUrl'],
type: 'object',
},
},
},
description: 'The signed URL and object ID (i.e. name/key) of the file.',
},
},
});

getSignedFileUploadUrlSchema

定義
場所フィールド必須制約
クエリcontentType文字列はい以下のソース拒否リストを除く mime-types の値。
クエリcontentLength整数はい最大 10000000 バイト。
200 レスポンスobjectId文字列はいCloud Storage のオブジェクト名/キー。
200 レスポンスsignedUrl文字列(URI)はい事前署名済みストレージ URL。

200 レスポンスオブジェクトには additionalProperties: false が設定されています。

除外される MIME タイプ: application/x-msdownload, application/x-msdos-program, application/x-bat, application/cmd, application/x-msi, application/x-pif, application/javascript, text/vbscript, application/vbs, application/wsf, application/x-powershell, application/x-sh, text/x-python, text/x-perl, application/zip, application/x-rar-compressed, application/x-7z-compressed, application/x-tar, application/gzip, application/x-ms-shortcut, application/x-iso9660-image, application/octet-stream, application/vnd.android.package-archive, and application/java-archive.

ルートでの使用: getChatMessageAttachmentUploadUrlRoute. 機能での使用: getChatMessageAttachmentUrlFeature.

完全なソースを表示
export const getSignedFileUploadUrlSchema = withSchema<OpenAPIOperation>({
parameters: [
{
in: 'query',
name: 'contentType',
required: true,
schema: {
enum: [...new Set(Object.values(types).filter(type => !DANGEROUS_MIME_TYPES.includes(type)))],
type: 'string',
},
},
{in: 'query', name: 'contentLength', required: true, schema: {maximum: MAX_CONTENT_LENGTH, type: 'integer'}},
],
responses: {
'200': {
content: {
'application/json': {
schema: {
$schema: 'http://json-schema.org/draft-07/schema#',
additionalProperties: false,
properties: {
objectId: {description: 'Cloud Storage object name/key.', type: 'string'},
signedUrl: {description: 'Pre-signed URL to access the object', format: 'uri', type: 'string'},
},
required: ['objectId', 'signedUrl'],
type: 'object',
},
},
},
description: 'The signed URL and object ID (i.e. name/key) of the file.',
},
},
});