メインコンテンツまでスキップ
バージョン: 0.13.0 (Previous)

📐 アトリビューションスキーマ

アトリビューションスキーマは、再利用可能なグループの形状と、アトリビューションルートが消費するボディ、パス、およびクエリ契約を定義します。

目次

エクスポートリクエスト場所契約
attributesSchemaN/Aオプションの name および空でない items;トップレベルの追加プロパティは拒否されます。
createAttributesSchemaボディnameitems が必須。
updateAttributesSchemaパス、ボディオプションの name のみ;追加プロパティは拒否されます。
getAttributeSchemaパス文字列アトリビューショングループID。
deleteAttributeSchemaパス文字列アトリビューショングループID。
findAttributesSchemaクエリ文字列 name フィルタおよび共有ページネーションパラメータ。
共有ソースコンテキストを表示
const attributeIdPathParameter: OpenAPIParameter = {
in: 'path',
name: 'attributeId',
required: true,
schema: {
type: 'string',
},
};

export const paginationQueryParametersSchema: OpenAPIParameter[] = [
{
in: 'query',
name: 'page',
required: false,
schema: {
maximum: 1000,
minimum: 1,
type: 'integer',
},
},
{
in: 'query',
name: 'limit',
required: false,
schema: {
maximum: 50,
minimum: 1,
type: 'integer',
},
},
];

詳細

attributesSchema

定義

再利用可能な保存/リクエスト形状。トップレベルのオブジェクトは additionalProperties: false を持つ;そのネストされた items オブジェクトはソース内でこの制限を宣言しない。

場所フィールド必須制約
N/Anamestringいいえ
N/AitemsarrayいいえminItems: 1
アイテムkeystringはい
アイテムvaluestringはい

フィーチャーでの使用: N/A — 再利用可能なスキーマ。

ルートでの使用: N/A — createAttributesSchema によって再使用される。

合成元: createAttributesSchema

完全なソースを表示
export const attributesSchema: SchemaDefinition = {
$schema: 'http://json-schema.org/draft-07/schema#',
additionalProperties: false,
properties: {
items: {
items: {
properties: {
key: { type: 'string' },
value: { type: 'string' },
},
required: ['key', 'value'],
type: 'object',
},
minItems: 1,
type: 'array',
},
name: { type: 'string' },
},
type: 'object',
};

createAttributesSchema

定義

再利用可能な形状を使用する必須JSONボディ。nameitems は必須;トップレベルの追加プロパティは拒否されます。

場所フィールド必須制約
ボディnamestringはい
ボディitemsarrayはい少なくとも1つのアイテム
ボディアイテムkeystringはい
ボディアイテムvaluestringはい

フィーチャーでの使用: createAttributeFeature

ルートでの使用: createAttributeRoute

完全なソースを表示
export const createAttributesSchema = withSchema({
requestBody: {
content: {
'application/json': {
schema: {
...attributesSchema,
required: ['name', 'items'],
},
},
},
required: true,
},
});

updateAttributesSchema

定義

文字列 attributeId パスパラメータとJSONボディを必要とします。スキーマは必須のボディフィールドを宣言していないため {} を許可しますが、updateAttributeGroup は空のボディを 400 で拒否します。

場所フィールド必須制約
パスattributeIdstringはい
ボディnamestringいいえ追加のボディプロパティなし

フィーチャーでの使用: updateAttributeFeature

ルートでの使用: updateAttributeRoute

完全なソースを表示
export const updateAttributesSchema = withSchema({
parameters: [{ ...attributeIdPathParameter }],
requestBody: {
content: {
'application/json': {
schema: {
$schema: 'http://json-schema.org/draft-07/schema#',
additionalProperties: false,
properties: {
name: { type: 'string' },
},
type: 'object',
},
},
},
required: true,
},
});

getAttributeSchema

定義

文字列 attributeId パスパラメータを必要とします。

場所フィールド必須制約
パスattributeIdstringはい

フィーチャーでの使用: getAttributeFeature

ルートでの使用: getAttributeRoute

完全なソースを表示
export const getAttributeSchema = withSchema({
parameters: [{ ...attributeIdPathParameter }],
});

deleteAttributeSchema

定義

文字列 attributeId パスパラメータを必要とします。

場所フィールド必須制約
パスattributeIdstringはい

フィーチャーでの使用: deleteAttributeFeature

ルートでの使用: deleteAttributeRoute

完全なソースを表示
export const deleteAttributeSchema = withSchema({
parameters: [{ ...attributeIdPathParameter }],
});

findAttributesSchema

定義

オプションのクエリ契約。name はアトリビューション固有の文字列フィルタ;ページネーションフィールドは paginationQueryParametersSchema から来ます。

場所フィールド必須制約
クエリnamestringいいえ
クエリpageintegerいいえ最小 1、最大 1000
クエリlimitintegerいいえ最小 1、最大 50

フィーチャーでの使用: findAttributesFeature

ルートでの使用: findAttributesRoute

完全なソースを表示
export const findAttributesSchema = withSchema({
parameters: [
{
in: 'query',
name: 'name',
required: false,
schema: {
type: 'string',
},
},
...paginationQueryParametersSchema,
],
});