diff --git a/openapi/activity-log/models/ActivityLog.yaml b/openapi/activity-log/models/ActivityLog.yaml index e9a50190c..7e9618d16 100644 --- a/openapi/activity-log/models/ActivityLog.yaml +++ b/openapi/activity-log/models/ActivityLog.yaml @@ -3,13 +3,21 @@ type: object properties: id: type: string + example: 181398 type: type: string + example: 'default' description: type: string + example: 'status-update' properties: - type: string + type: object + example: { + "previous": "payment-received", + "new": "refunded" + } created_at: type: string + example: '2020-03-24T10:11:12.000000Z' user: $ref: '../../users/responses/UserResponse.yaml' diff --git a/openapi/assets/models/Asset.yaml b/openapi/assets/models/Asset.yaml index 1c4729e48..0c81a3063 100644 --- a/openapi/assets/models/Asset.yaml +++ b/openapi/assets/models/Asset.yaml @@ -3,34 +3,50 @@ type: object properties: id: type: string + example: 1w2ndkgo title: type: string + example: Olive clog boots type: type: string + nullable: true + example: product caption: type: string + example: Olive clog boots kind: type: string + example: image external: type: boolean + example: false position: type: integer + example: 1 primary: type: boolean + example: true url: type: string + example: http:\/\/cdn.test\/storage\/products\/2020\/01\/SBBsDXmM8pg.jpg sub_kind: type: string + example: jpeg extension: type: string + example: 'jpg' original_filename: type: string + example: 'B15Z31__58612_std.jpg' size: type: string + example: 88408 width: type: string + example: 601 height: type: string + example: 1000 transforms: $ref: '../responses/AssetTransformCollection.yaml' tags: diff --git a/openapi/categories/models/Category.yaml b/openapi/categories/models/Category.yaml index 12a929cf3..bbb88a26f 100644 --- a/openapi/categories/models/Category.yaml +++ b/openapi/categories/models/Category.yaml @@ -1,120 +1,37 @@ title: Category type: object -x-examples: - Standard with mapped attributes: - id: v8l4pl01 - sort: 'min_price:asc' - products_count: 0 - children_count: 1 - left_pos: 1 - right_pos: 938 - description: Category description - meta_keywords: null - name: Fasteners - page_title: Seo page title - short_description: Short Description - meta_description: Page meta description - layout: [] - primary_asset: [] - Full response: - id: v8l4pl01 - sort: 'min_price:asc' - products_count: 0 - children_count: 1 - left_pos: 1 - right_pos: 938 - attribute_data: - description: - webstore: - en: Category description - meta_keywords: - webstore: - en: "" - name: - webstore: - en: Category name - page_title: - webstore: - en: Page title - short_description: - webstore: - en: Short description - meta_description: - webstore: - en: Meta description - layout: [] - primary_asset: [] - Full response with child: - id: v8l4pl01 - sort: 'min_price:asc' - products_count: 0 - children_count: 1 - left_pos: 1 - right_pos: 938 - attribute_data: - description: - webstore: - en: Category description - meta_keywords: - webstore: - en: "" - name: - webstore: - en: Category name - page_title: - webstore: - en: Page title - short_description: - webstore: - en: Short description - meta_description: - webstore: - en: Meta description - children: - data: - - id: p09prlrn - sort: 'min_price:asc' - left_pos: 2 - right_pos: 937 - attribute_data: - description: - webstore: - en: '' - meta_keywords: - webstore: - en: '' - name: - webstore: - en: Child Category - page_title: - webstore: - en: Child category SEO title - short_description: - webstore: - en: '' - meta_description: - webstore: - en: Child Category meta description - layout: [] - primary_asset: [] - layout: [] - primary_asset: [] description: '' properties: id: type: string + example: v8l4pl01 sort: type: string + example: min_price:asc products_count: type: integer + example: 778 children_count: type: integer + example: 15 + depth: + type: integer + example: 0 left_pos: type: integer + example: 1 right_pos: type: integer + example: 2 + created_at: + type: string + example: "2020-11-19T10:28:56.000000Z" name: type: string + example: Fashion + description: + type: string + example: "

Discover early autumn fashion. Cotton silk leopard smock dresses. Deep v-neck knitted tank tops. Black contrast stitch denim jeans. Khaki quilted jackets with tortoiseshell toggle buttons. Tobacco gingham cotton dresses. Shop all of fashion below.<\/p>" attribute_data: type: object children: diff --git a/openapi/channels/paths/channels.id.yaml b/openapi/channels/paths/channels.id.yaml index 720e8320b..c9e073561 100644 --- a/openapi/channels/paths/channels.id.yaml +++ b/openapi/channels/paths/channels.id.yaml @@ -6,10 +6,6 @@ parameters: required: true get: summary: Get the channel resource - x-code-samples: - - lang: PHP - source: - $ref: ../examples/code/fetch-channel/laravel.php responses: '200': description: OK @@ -25,11 +21,6 @@ get: $ref: '../../global/responses/ApiError.yaml' operationId: get-channels-channelId description: '' - parameters: - - schema: - type: string - in: query - name: includes tags: - Channels put: @@ -50,7 +41,7 @@ put: operationId: put-channels-channelId requestBody: content: - multipart/form-data: + application/json: schema: $ref: '../requests/UpdateChannelBody.yaml' description: '' diff --git a/openapi/channels/paths/channels.yaml b/openapi/channels/paths/channels.yaml index 62d6b6ee4..c3637df40 100644 --- a/openapi/channels/paths/channels.yaml +++ b/openapi/channels/paths/channels.yaml @@ -9,16 +9,8 @@ get: $ref: '../responses/ChannelCollection.yaml' operationId: get-channels parameters: - - schema: - type: string - in: query - name: includes - description: Comma separated includes for the resource - - schema: - type: number - in: query - name: per_page - description: How many results per page + - $ref: '../../openapi.yaml#/components/parameters/perPageParam' + - $ref: '../../openapi.yaml#/components/parameters/pageParam' description: Gets a paginated list of all channel tags: - Channels @@ -41,10 +33,9 @@ post: operationId: post-channels requestBody: content: - multipart/form-data: + application/json: schema: $ref: '../requests/CreateChannelBody.yaml' - examples: {} description: '' tags: - Channels diff --git a/openapi/channels/requests/CreateChannelBody.yaml b/openapi/channels/requests/CreateChannelBody.yaml index 8302cc0ce..41de96888 100644 --- a/openapi/channels/requests/CreateChannelBody.yaml +++ b/openapi/channels/requests/CreateChannelBody.yaml @@ -3,11 +3,18 @@ type: object properties: handle: type: string + example: "mobileapp" name: type: string + example: "Mobile App" url: type: string nullable: true + example: "mobileapp:Index" default: type: boolean - nullable: true \ No newline at end of file + nullable: true + default: false +required: + - name + - handle \ No newline at end of file diff --git a/openapi/channels/requests/UpdateChannelBody.yaml b/openapi/channels/requests/UpdateChannelBody.yaml index 71b3f4406..b3e19a27c 100644 --- a/openapi/channels/requests/UpdateChannelBody.yaml +++ b/openapi/channels/requests/UpdateChannelBody.yaml @@ -4,12 +4,16 @@ properties: handle: type: string nullable: true + example: "webstore" name: type: string nullable: true + example: "Webstore" url: type: string nullable: true + example: "localhost:8080" default: type: boolean - nullable: true \ No newline at end of file + nullable: true + example: true \ No newline at end of file diff --git a/openapi/collections/models/Collection.yaml b/openapi/collections/models/Collection.yaml index e505d0e51..7102c2b0d 100644 --- a/openapi/collections/models/Collection.yaml +++ b/openapi/collections/models/Collection.yaml @@ -1,18 +1,10 @@ title: Collection type: object -description: |- - ### Available includes - - - routes - - layout - - channels - - assets - - attributes - - products - - customerGroups +description: properties: id: type: string + example: v8l4pl01 attribute_data: type: object routes: diff --git a/openapi/countries/models/Country.yaml b/openapi/countries/models/Country.yaml index 7af878fa9..0b4551034 100644 --- a/openapi/countries/models/Country.yaml +++ b/openapi/countries/models/Country.yaml @@ -3,17 +3,25 @@ type: object properties: id: type: string + example: v8l4q190 name: type: string + example: United Kingdom region: type: string + example: Europe iso_a_2: type: string + example: GB iso_a_3: type: string + example: GBR iso_numeric: type: string + example: 826 preferred: type: boolean + example: true enabled: - type: boolean \ No newline at end of file + type: boolean + example: true \ No newline at end of file diff --git a/openapi/currencies/models/Currency.yaml b/openapi/currencies/models/Currency.yaml index 81c690132..1e1db5adf 100644 --- a/openapi/currencies/models/Currency.yaml +++ b/openapi/currencies/models/Currency.yaml @@ -3,19 +3,28 @@ type: object properties: id: type: string - code: - type: string + example: kdj58jom name: type: string + example: British Pound + code: + type: string + example: GBP enabled: type: boolean + example: true format: type: string + example: £{price} exchange_rate: type: string + example: 1 decimal_point: type: string + example: '.' thousand_point: type: string + example: ',' default: - type: boolean \ No newline at end of file + type: boolean + example: true \ No newline at end of file diff --git a/openapi/global/models/Pagination.yaml b/openapi/global/models/Pagination.yaml index bbe5c72e9..db50c254a 100644 --- a/openapi/global/models/Pagination.yaml +++ b/openapi/global/models/Pagination.yaml @@ -16,6 +16,7 @@ properties: example: 15 path: type: string + example: http:\/\/api.test\/api\/v1\/channels per_page: type: integer example: 1 @@ -23,4 +24,35 @@ properties: type: integer nullable: true total: - type: integer \ No newline at end of file + type: integer + links: + type: array + example: [ + { + "url": null, + "label": "« Previous", + "active": false + }, + { + "url": "http:\/\/api.test\/api\/v1\/channels?page=1", + "label": "1", + "active": true + }, + { + "url": null, + "label": "Next »", + "active": false + } + ] + items: + type: object + properties: + url: + type: string + nullable: true + label: + type: string + nullable: true + active: + type: boolean + nullable: true \ No newline at end of file diff --git a/openapi/languages/paths/languages.yaml b/openapi/languages/paths/languages.yaml index 5feb1786a..12bf41f95 100644 --- a/openapi/languages/paths/languages.yaml +++ b/openapi/languages/paths/languages.yaml @@ -11,6 +11,9 @@ get: $ref: '../responses/LanguageCollection.yaml' operationId: get-languages description: Returns a paginated list of Languages + parameters: + - $ref: '../../openapi.yaml#/components/parameters/perPageParam' + - $ref: '../../openapi.yaml#/components/parameters/pageParam' post: summary: Create Language tags: @@ -32,6 +35,6 @@ post: description: Create a new language requestBody: content: - multipart/form-data: + application/json: schema: $ref: '../requests/CreateLanguageBody.yaml' diff --git a/openapi/languages/requests/CreateLanguageBody.yaml b/openapi/languages/requests/CreateLanguageBody.yaml index 59d4336eb..78d56418f 100644 --- a/openapi/languages/requests/CreateLanguageBody.yaml +++ b/openapi/languages/requests/CreateLanguageBody.yaml @@ -3,18 +3,20 @@ type: object properties: name: type: string - lang: + example: 'English' + code: type: string - iso: - type: string - description: Unique + example: 'en-gb' + pattern: '^[a-zA-Z0-9-]*$' enabled: type: boolean + default: false default: type: boolean + default: false current: type: boolean + default: false required: - name - - lang - - iso \ No newline at end of file + - code \ No newline at end of file diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 166bd0736..0a180ab37 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -1,4 +1,29 @@ openapi: 3.0.0 +components: + parameters: + includeParam: + in: query + name: include + required: false + schema: + type: string + description: Which related resources to include in the response. + perPageParam: + in: query + name: per_page + required: false + schema: + type: integer + minimum: 1 + description: The number of resources to show per page on the response + pageParam: + in: query + name: page + required: false + schema: + type: integer + minimum: 1 + description: The current page when returning resources. info: title: GetCandy contact: @@ -226,6 +251,8 @@ paths: $ref: './recycle-bin/paths/recycle-bin.yaml' '/recycle-bin/{itemId}': $ref: './recycle-bin/paths/recycle-bin.id.yaml' + '/recycle-bin/{itemId}/restore': + $ref: './recycle-bin/paths/recycle-bin.id.restore.yaml' '/reports/sales': $ref: './reports/paths/reports.sales.yaml' '/reports/customers/spending': @@ -296,6 +323,76 @@ paths: $ref: './users/paths/users.current.yaml' '/versions/{modelId}/restore': $ref: './versions/paths/versions.id.restore.yaml' +tags: + - name: Assets + description: |- + ### Available Includes + | Include | Description | + | ----- | --- | + | `transforms` | Any asset transforms, such as thumbnails | + | `tags` | Any associated tags | + - name: Categories + description: |- + ### Available Includes + | Include | Description | + | ----- | --- | + | `attributes` | The attributes related to the product | + | `assets` | The assets related to the category | + | `children` | Any child categories | + | `draft` | The draft resource for the category (if it exists) | + | `layout` | The associated layout resource | + | `publishedParent` | If this category is a draft, this will be the published (live) version | + | `assets` | Any assets related to the product | + | `routes` | The category's routes | + | `channels` | The channels related to the category | + | `primaryAsset` | Returns the primary asset if it exists | + | `versions` | The past versions of this category | + | `customerGroups` | The associated customer groups | + - name: Collections + description: |- + ### Available Includes + | Include | Description | + | ----- | --- | + | `attributes` | The attributes related to the collection | + | `assets` | The assets related to the collection | + | `routes` | The collection's routes | + | `layout` | The layout assigned to the collection | + | `channels` | The channels related to the collection | + | `assets` | The channels related to the collection | + | `customerGroups` | The associated customer groups | + | `products` | The products that belong to the collection | + - name: Routes + description: |- + ### Available Includes + | Include | Example | Description + | ----- | --- | --- | + | `element` | `element.variants` | The included element to return in the response. | + | `language` | | The language related to the route | + + When including `element` you will have access to all the available includes for that resource. For example if `element` was a Product, you would be able to also load `element.variants` + - name: Products + description: |- + ### Available Includes + | Include | Description | + | ----- | --- | + | `attributes` | The attributes related to the product | + | `assets` | The assets related to the product | + | `draft` | The draft resource for the product (if it exists) | + | `layout` | The associated layout resource | + | `publishedParent` | If this product is a draft, this will be the published (live) version | + | `assets` | Any assets related to the product | + | `family` | The ProductFamily this product belongs to | + | `routes` | The Product's routes | + | `channels` | The channels related to the product | + | `firstVariant` | The first variant associated in the database, uses the first variant ID to determine | + | `primaryAsset` | Returns the primary asset if it exists | + | `categories` | Categories associated to the product | + | `variants` | The product variants | + | `discounts` | Any discounts available for this product | + | `collections` | Any collections this product is associated to | + | `associations` | Any product associations e.g. Cross Sell / Up Sell | + | `versions` | The past versions of this product | + | `customerGroups` | The associated customer groups | x-tagGroups: - name: General tags: diff --git a/openapi/recycle-bin/models/RecycleBin.yaml b/openapi/recycle-bin/models/RecycleBin.yaml index d0042f489..8fa9e0e9d 100644 --- a/openapi/recycle-bin/models/RecycleBin.yaml +++ b/openapi/recycle-bin/models/RecycleBin.yaml @@ -3,13 +3,17 @@ type: object properties: id: type: string + example: gy6wjdwp1q type: type: string name: type: string + example: Marathon Bar thumbnail: type: string + example: "http:\/\/cdn.test/products\/1990\/11\/12\/thumbnails\/thumbnail_8exmokdn4wb79l51.jpg" deleted_at: type: string + example: "1990-07-19T14:24:37.000000Z" recyclable: type: object diff --git a/openapi/recycle-bin/paths/recycle-bin.id.restore.yaml b/openapi/recycle-bin/paths/recycle-bin.id.restore.yaml new file mode 100644 index 000000000..b8e2ce0e4 --- /dev/null +++ b/openapi/recycle-bin/paths/recycle-bin.id.restore.yaml @@ -0,0 +1,16 @@ +parameters: + - schema: + type: string + name: itemId + description: The ID representing the row in the `recycle_bin` table. + in: path + required: true +post: + summary: Restore an item from the recyle bin + tags: + - Recycle Bin + responses: + '200': + description: No Content + operationId: restore-item + description: Restore an item from the recyle bin \ No newline at end of file diff --git a/openapi/recycle-bin/paths/recycle-bin.id.yaml b/openapi/recycle-bin/paths/recycle-bin.id.yaml index e0f101d4a..b92d8afa6 100644 --- a/openapi/recycle-bin/paths/recycle-bin.id.yaml +++ b/openapi/recycle-bin/paths/recycle-bin.id.yaml @@ -2,6 +2,7 @@ parameters: - schema: type: string name: itemId + description: The ID representing the row in the `recycle_bin` table. in: path required: true get: diff --git a/openapi/recycle-bin/paths/recycle-bin.yaml b/openapi/recycle-bin/paths/recycle-bin.yaml index d49a9a4da..d57ddea64 100644 --- a/openapi/recycle-bin/paths/recycle-bin.yaml +++ b/openapi/recycle-bin/paths/recycle-bin.yaml @@ -2,6 +2,10 @@ get: summary: Get records tags: - Recycle Bin + parameters: + - $ref: '../../openapi.yaml#/components/parameters/perPageParam' + - $ref: '../../openapi.yaml#/components/parameters/pageParam' + - $ref: '../../openapi.yaml#/components/parameters/includeParam' responses: '200': description: OK diff --git a/openapi/routes/models/Route.yaml b/openapi/routes/models/Route.yaml index 632f0bc4d..0b6946cc8 100644 --- a/openapi/routes/models/Route.yaml +++ b/openapi/routes/models/Route.yaml @@ -3,6 +3,7 @@ description: |- properties: id: type: string + example: v8l4pl01 default: type: boolean default: false @@ -11,14 +12,41 @@ properties: default: false slug: type: string + example: fashion description: type: string nullable: true + example: "Fashion clothes" type: type: string + example: category drafted_at: type: string nullable: true + example: "2020-11-19T10:28:56.000000Z" + element: + type: object + example: { + "data": { + "id": "v8l4pl01", + "sort": "min_price:asc", + "drafted_at": null, + "products_count": 0, + "children_count": 0, + "depth": 0, + "has_draft": false, + "left_pos": 1, + "right_pos": 2, + "created_at": "2020-11-19T10:28:56.000000Z", + "updated_at": "2021-02-15T10:15:12.000000Z", + "name": "Fashion", + "description": "

Discover early autumn fashion. Cotton silk leopard smock dresses. Deep v-neck knitted tank tops. Black contrast stitch denim jeans. Khaki quilted jackets with tortoiseshell toggle buttons. Tobacco gingham cotton dresses. Shop all of fashion below.<\/p>", + "draft": [], + "published_parent": [], + "layout": [], + "primary_asset": [] + } + } x-tags: - Routes type: object \ No newline at end of file diff --git a/openapi/routes/paths/routes.yaml b/openapi/routes/paths/routes.yaml index d91d07575..50069a180 100644 --- a/openapi/routes/paths/routes.yaml +++ b/openapi/routes/paths/routes.yaml @@ -9,6 +9,11 @@ get: application/json: schema: $ref: '../responses/RouteCollection.yaml' + + parameters: + - $ref: '../../openapi.yaml#/components/parameters/perPageParam' + - $ref: '../../openapi.yaml#/components/parameters/pageParam' + - $ref: '../../openapi.yaml#/components/parameters/includeParam' operationId: get-routes description: Returns a paginated list of Routes post: diff --git a/openapi/settings/models/Setting.yaml b/openapi/settings/models/Setting.yaml index ce6c10c7d..633d8c7f3 100644 --- a/openapi/settings/models/Setting.yaml +++ b/openapi/settings/models/Setting.yaml @@ -3,12 +3,21 @@ type: object properties: id: type: string + example: v8l4pl01 name: type: string + example: Products handle: type: string + example: products content: type: object + example: { + "transforms": [ + "large_thumbnail" + ], + "asset_source": "products" + } x-examples: products-example: id: v8l4pl01 diff --git a/openapi/tags/models/Tag.yaml b/openapi/tags/models/Tag.yaml index ce482ff10..7c0ef6498 100644 --- a/openapi/tags/models/Tag.yaml +++ b/openapi/tags/models/Tag.yaml @@ -3,5 +3,7 @@ type: object properties: id: type: string + example: 1w2ndkgo name: type: string + example: download diff --git a/openapi/versions/paths/versions.id.restore.yaml b/openapi/versions/paths/versions.id.restore.yaml index 7176f0f7d..be4aef050 100644 --- a/openapi/versions/paths/versions.id.restore.yaml +++ b/openapi/versions/paths/versions.id.restore.yaml @@ -1,7 +1,7 @@ parameters: - schema: type: string - name: modelId + name: versionId in: path required: true post: