Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Update api platform specs and swagger (#11263)

Szymon Iwacz574a2069b7fc
diff --git a/api/docs/v2/platform/index.yaml b/api/docs/v2/platform/index.yaml
index 9dbe7df557..62a1842b98 100644
--- a/api/docs/v2/platform/index.yaml
+++ b/api/docs/v2/platform/index.yaml
@@ -57,8 +57,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-06T06:53:18.846Z'
- updated_at: '2021-08-06T06:53:18.846Z'
+ created_at: '2021-08-18T07:08:27.889Z'
+ updated_at: '2021-08-18T07:08:27.889Z'
deleted_at:
label:
relationships:
@@ -85,8 +85,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-06T06:53:18.853Z'
- updated_at: '2021-08-06T06:53:18.853Z'
+ created_at: '2021-08-18T07:08:27.894Z'
+ updated_at: '2021-08-18T07:08:27.894Z'
deleted_at:
label:
relationships:
@@ -141,7 +141,7 @@ paths:
Example:
value:
data:
- id: '5'
+ id: '1'
type: address
attributes:
firstname: John
@@ -154,18 +154,18 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-06T06:53:19.077Z'
- updated_at: '2021-08-06T06:53:19.077Z'
+ created_at: '2021-08-18T07:08:28.218Z'
+ updated_at: '2021-08-18T07:08:28.218Z'
deleted_at:
label:
relationships:
country:
data:
- id: '4'
+ id: '2'
type: country
state:
data:
- id: '5'
+ id: '1'
type: state
user:
data:
@@ -230,7 +230,7 @@ paths:
Example:
value:
data:
- id: '6'
+ id: '1'
type: address
attributes:
firstname: John
@@ -243,18 +243,18 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-06T06:53:19.150Z'
- updated_at: '2021-08-06T06:53:19.150Z'
+ created_at: '2021-08-18T07:08:28.277Z'
+ updated_at: '2021-08-18T07:08:28.277Z'
deleted_at:
label:
relationships:
country:
data:
- id: '6'
+ id: '1'
type: country
state:
data:
- id: '6'
+ id: '1'
type: state
user:
data:
@@ -302,7 +302,7 @@ paths:
Example:
value:
data:
- id: '8'
+ id: '1'
type: address
attributes:
firstname: Jack
@@ -315,18 +315,18 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-06T06:53:19.236Z'
- updated_at: '2021-08-06T06:53:19.247Z'
+ created_at: '2021-08-18T07:08:28.357Z'
+ updated_at: '2021-08-18T07:08:28.369Z'
deleted_at:
label:
relationships:
country:
data:
- id: '9'
+ id: '1'
type: country
state:
data:
- id: '8'
+ id: '1'
type: state
user:
data:
@@ -439,8 +439,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-08-06T06:53:19.739Z'
- updated_at: '2021-08-06T06:53:19.739Z'
+ created_at: '2021-08-18T07:08:28.791Z'
+ updated_at: '2021-08-18T07:08:28.791Z'
relationships:
product:
data:
@@ -454,8 +454,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-08-06T06:53:19.836Z'
- updated_at: '2021-08-06T06:53:19.836Z'
+ created_at: '2021-08-18T07:08:28.872Z'
+ updated_at: '2021-08-18T07:08:28.872Z'
relationships:
product:
data:
@@ -506,20 +506,20 @@ paths:
Example:
value:
data:
- id: '5'
+ id: '1'
type: classification
attributes:
position: 1
- created_at: '2021-08-06T06:53:20.242Z'
- updated_at: '2021-08-06T06:53:20.242Z'
+ created_at: '2021-08-18T07:08:29.237Z'
+ updated_at: '2021-08-18T07:08:29.237Z'
relationships:
product:
data:
- id: '5'
+ id: '1'
type: product
taxon:
data:
- id: '10'
+ id: '2'
type: taxon
'422':
description: invalid request
@@ -568,20 +568,20 @@ paths:
Example:
value:
data:
- id: '6'
+ id: '1'
type: classification
attributes:
position: 1
- created_at: '2021-08-06T06:53:20.399Z'
- updated_at: '2021-08-06T06:53:20.399Z'
+ created_at: '2021-08-18T07:08:29.378Z'
+ updated_at: '2021-08-18T07:08:29.378Z'
relationships:
product:
data:
- id: '6'
+ id: '1'
type: product
taxon:
data:
- id: '12'
+ id: '2'
type: taxon
'404':
description: Record not found
@@ -627,20 +627,20 @@ paths:
Example:
value:
data:
- id: '8'
+ id: '1'
type: classification
attributes:
position: 1
- created_at: '2021-08-06T06:53:20.705Z'
- updated_at: '2021-08-06T06:53:20.705Z'
+ created_at: '2021-08-18T07:08:29.657Z'
+ updated_at: '2021-08-18T07:08:29.657Z'
relationships:
product:
data:
- id: '8'
+ id: '1'
type: product
taxon:
data:
- id: '16'
+ id: '2'
type: taxon
'422':
description: invalid request
@@ -734,20 +734,20 @@ paths:
Example:
value:
data:
- id: '13'
+ id: '1'
type: classification
attributes:
position: 2
- created_at: '2021-08-06T06:53:21.437Z'
- updated_at: '2021-08-06T06:53:21.461Z'
+ created_at: '2021-08-18T07:08:30.317Z'
+ updated_at: '2021-08-18T07:08:30.336Z'
relationships:
product:
data:
- id: '13'
+ id: '1'
type: product
taxon:
data:
- id: '26'
+ id: '2'
type: taxon
'422':
description: invalid request
@@ -795,7 +795,7 @@ paths:
Example:
value:
data:
- - id: '34'
+ - id: '1'
type: country
attributes:
iso_name: UNITED STATES
@@ -804,13 +804,13 @@ paths:
name: United States of America
numcode: 840
states_required: true
- updated_at: '2021-08-06T06:53:21.782Z'
+ updated_at: '2021-08-18T07:08:30.636Z'
zipcode_required: true
- created_at: '2021-08-06T06:53:21.782Z'
+ created_at: '2021-08-18T07:08:30.636Z'
relationships:
states:
data: []
- - id: '35'
+ - id: '2'
type: country
attributes:
iso_name: ISO_NAME_2
@@ -819,13 +819,13 @@ paths:
name: NAME_2
numcode: 840
states_required: false
- updated_at: '2021-08-06T06:53:21.793Z'
+ updated_at: '2021-08-18T07:08:30.645Z'
zipcode_required: true
- created_at: '2021-08-06T06:53:21.793Z'
+ created_at: '2021-08-18T07:08:30.645Z'
relationships:
states:
data: []
- - id: '36'
+ - id: '3'
type: country
attributes:
iso_name: ISO_NAME_3
@@ -834,9 +834,9 @@ paths:
name: NAME_3
numcode: 840
states_required: false
- updated_at: '2021-08-06T06:53:21.796Z'
+ updated_at: '2021-08-18T07:08:30.647Z'
zipcode_required: true
- created_at: '2021-08-06T06:53:21.796Z'
+ created_at: '2021-08-18T07:08:30.647Z'
relationships:
states:
data: []
@@ -880,7 +880,7 @@ paths:
Example:
value:
data:
- id: '41'
+ id: '2'
type: country
attributes:
iso_name: ISO_NAME_6
@@ -889,9 +889,9 @@ paths:
name: NAME_6
numcode: 840
states_required: false
- updated_at: '2021-08-06T06:53:21.864Z'
+ updated_at: '2021-08-18T07:08:30.713Z'
zipcode_required: true
- created_at: '2021-08-06T06:53:21.864Z'
+ created_at: '2021-08-18T07:08:30.713Z'
relationships:
states:
data: []
@@ -911,11 +911,11 @@ paths:
Example:
value:
error: The access token is invalid
- "/api/v2/platform/taxons":
+ "/api/v2/platform/option_types":
get:
- summary: Returns a list of Taxons
+ summary: Returns a list of OptionTypes
tags:
- - Taxons
+ - OptionTypes
security:
- bearer_auth: []
parameters:
@@ -933,13 +933,13 @@ paths:
in: query
description: 'Select which associated resources you would like to fetch, see:
<a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
- example: taxonomy,parent,children
+ example: ''
schema:
type: string
- name: filter
in: query
description: ''
- example: taxonomy_id_eq=1&name_cont=Shirts
+ example: option_type_id_eq=1&name_cont=Size
schema:
type: string
responses:
@@ -951,121 +951,40 @@ paths:
Example:
value:
data:
- - id: '32'
- type: taxon
+ - id: '1'
+ type: option_type
attributes:
- position: 0
- name: taxon_16
- permalink: taxonomy-16/taxon-16
- lft: 2
- rgt: 3
- description:
- created_at: '2021-08-06T06:53:21.978Z'
- updated_at: '2021-08-06T06:53:21.982Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 1
- pretty_name: taxonomy_16 -> taxon_16
- seo_title: taxon_16
- is_root: false
- is_child: true
- is_leaf: true
+ name: foo-size-1
+ presentation: Size
+ position: 1
+ created_at: '2021-08-18T07:08:30.787Z'
+ updated_at: '2021-08-18T07:08:30.787Z'
+ filterable: true
relationships:
- parent:
- data:
- id: '31'
- type: taxon
- taxonomy:
- data:
- id: '16'
- type: taxonomy
- children:
+ option_values:
data: []
- image:
- data:
- id: '16'
- type: taxon_image
- - id: '33'
- type: taxon
+ - id: '2'
+ type: option_type
attributes:
- position: 0
- name: taxon_17
- permalink: taxonomy-16/taxon-17
- lft: 4
- rgt: 5
- description:
- created_at: '2021-08-06T06:53:22.008Z'
- updated_at: '2021-08-06T06:53:22.013Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 1
- pretty_name: taxonomy_16 -> taxon_17
- seo_title: taxon_17
- is_root: false
- is_child: true
- is_leaf: true
+ name: foo-size-2
+ presentation: Size
+ position: 2
+ created_at: '2021-08-18T07:08:30.790Z'
+ updated_at: '2021-08-18T07:08:30.790Z'
+ filterable: true
relationships:
- parent:
- data:
- id: '31'
- type: taxon
- taxonomy:
- data:
- id: '16'
- type: taxonomy
- children:
+ option_values:
data: []
- image:
- data:
- id: '17'
- type: taxon_image
- - id: '31'
- type: taxon
- attributes:
- position: 0
- name: taxonomy_16
- permalink: taxonomy-16
- lft: 1
- rgt: 6
- description:
- created_at: '2021-08-06T06:53:21.950Z'
- updated_at: '2021-08-06T06:53:22.027Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 0
- pretty_name: taxonomy_16
- seo_title: taxonomy_16
- is_root: true
- is_child: false
- is_leaf: false
- relationships:
- parent:
- data:
- taxonomy:
- data:
- id: '16'
- type: taxonomy
- children:
- data:
- - id: '32'
- type: taxon
- - id: '33'
- type: taxon
- image:
- data:
meta:
- count: 3
- total_count: 3
+ count: 2
+ total_count: 2
total_pages: 1
links:
- self: http://www.example.com/api/v2/platform/taxons?page=1&per_page=&include=&filter=
- next: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
- prev: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
- last: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
- first: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
+ self: http://www.example.com/api/v2/platform/option_types?page=1&per_page=&include=&filter=
+ next: http://www.example.com/api/v2/platform/option_types?include=&page=1&per_page=
+ prev: http://www.example.com/api/v2/platform/option_types?include=&page=1&per_page=
+ last: http://www.example.com/api/v2/platform/option_types?include=&page=1&per_page=
+ first: http://www.example.com/api/v2/platform/option_types?include=&page=1&per_page=
'401':
description: Authentication Failed
content:
@@ -1075,9 +994,9 @@ paths:
value:
error: The access token is invalid
post:
- summary: Creates a Taxon
+ summary: Creates an OptionType
tags:
- - Taxons
+ - OptionTypes
security:
- bearer_auth: []
parameters:
@@ -1085,7 +1004,7 @@ paths:
in: query
description: 'Select which associated resources you would like to fetch, see:
<a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
- example: taxonomy,parent,children
+ example: ''
schema:
type: string
responses:
@@ -1097,39 +1016,18 @@ paths:
Example:
value:
data:
- id: '38'
- type: taxon
+ id: '1'
+ type: option_type
attributes:
- position: 0
- name: taxon_20
- permalink: taxonomy-18/taxon-20
- lft: 2
- rgt: 3
- description:
- created_at: '2021-08-06T06:53:22.225Z'
- updated_at: '2021-08-06T06:53:22.231Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 1
- pretty_name: taxonomy_18 -> taxon_20
- seo_title: taxon_20
- is_root: false
- is_child: true
- is_leaf: true
+ name: foo-size-5
+ presentation: Size
+ position: 1
+ created_at: '2021-08-18T07:08:30.866Z'
+ updated_at: '2021-08-18T07:08:30.866Z'
+ filterable: true
relationships:
- parent:
- data:
- id: '37'
- type: taxon
- taxonomy:
- data:
- id: '18'
- type: taxonomy
- children:
+ option_values:
data: []
- image:
- data:
'422':
description: invalid request
content:
@@ -1137,22 +1035,22 @@ paths:
examples:
Example:
value:
- error: Name can't be blank and Taxonomy can't be blank
+ error: Name can't be blank and Presentation can't be blank
errors:
name:
- can't be blank
- taxonomy:
+ presentation:
- can't be blank
requestBody:
content:
application/json:
schema:
- "$ref": "#/components/schemas/taxon_params"
- "/api/v2/platform/taxons/{id}":
+ "$ref": "#/components/schemas/optiontype_params"
+ "/api/v2/platform/option_types/{id}":
get:
- summary: Returns a Taxon
+ summary: Returns an OptionType
tags:
- - Taxons
+ - OptionTypes
security:
- bearer_auth: []
parameters:
@@ -1165,7 +1063,7 @@ paths:
in: query
description: 'Select which associated resources you would like to fetch, see:
<a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
- example: taxonomy,parent,children
+ example: ''
schema:
type: string
responses:
@@ -1177,43 +1075,18 @@ paths:
Example:
value:
data:
- id: '40'
- type: taxon
+ id: '1'
+ type: option_type
attributes:
- position: 0
- name: taxon_21
- permalink: taxonomy-19/taxon-21
- lft: 2
- rgt: 3
- description:
- created_at: '2021-08-06T06:53:22.320Z'
- updated_at: '2021-08-06T06:53:22.324Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 1
- pretty_name: taxonomy_19 -> taxon_21
- seo_title: taxon_21
- is_root: false
- is_child: true
- is_leaf: true
+ name: foo-size-6
+ presentation: Size
+ position: 1
+ created_at: '2021-08-18T07:08:30.920Z'
+ updated_at: '2021-08-18T07:08:30.920Z'
+ filterable: true
relationships:
- parent:
- data:
- id: '39'
- type: taxon
- taxonomy:
- data:
- id: '19'
- type: taxonomy
- children:
+ option_values:
data: []
- products:
- data: []
- image:
- data:
- id: '20'
- type: taxon_image
'404':
description: Record not found
content:
@@ -1231,9 +1104,9 @@ paths:
value:
error: The access token is invalid
put:
- summary: Updates a Taxon
+ summary: Updates an OptionType
tags:
- - Taxons
+ - OptionTypes
security:
- bearer_auth: []
parameters:
@@ -1246,7 +1119,7 @@ paths:
in: query
description: 'Select which associated resources you would like to fetch, see:
<a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
- example: taxonomy,parent,children
+ example: ''
schema:
type: string
responses:
@@ -1258,41 +1131,18 @@ paths:
Example:
value:
data:
- id: '44'
- type: taxon
+ id: '1'
+ type: option_type
attributes:
- position: 0
- name: T-Shirts
- permalink: taxonomy-21/taxon-23
- lft: 2
- rgt: 3
- description:
- created_at: '2021-08-06T06:53:22.511Z'
- updated_at: '2021-08-06T06:53:22.542Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 1
- pretty_name: taxonomy_21 -> T-Shirts
- seo_title: T-Shirts
- is_root: false
- is_child: true
- is_leaf: true
+ name: Size-X
+ presentation: Size
+ position: 1
+ created_at: '2021-08-18T07:08:31.000Z'
+ updated_at: '2021-08-18T07:08:31.009Z'
+ filterable: true
relationships:
- parent:
- data:
- id: '43'
- type: taxon
- taxonomy:
- data:
- id: '21'
- type: taxonomy
- children:
+ option_values:
data: []
- image:
- data:
- id: '22'
- type: taxon_image
'422':
description: invalid request
content:
@@ -1324,11 +1174,11 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/taxon_params"
+ "$ref": "#/components/schemas/optiontype_params"
delete:
- summary: Deletes a Taxon
+ summary: Deletes an OptionType
tags:
- - Taxons
+ - OptionTypes
security:
- bearer_auth: []
parameters:
@@ -1356,25 +1206,1067 @@ paths:
Example:
value:
error: The access token is invalid
-servers:
-- url: https://{defaultHost}
- variables:
- defaultHost:
- default: localhost:3000
-components:
- securitySchemes:
- bearer_auth:
- type: http
- scheme: bearer
- schemas:
- address_params:
- type: object
- properties:
- country_id:
- type: string
- state_id:
+ "/api/v2/platform/option_values":
+ get:
+ summary: Returns a list of OptionValues
+ tags:
+ - OptionValues
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: page
+ in: query
+ example: 1
+ schema:
+ type: integer
+ - name: per_page
+ in: query
+ example: 50
+ schema:
+ type: integer
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: option_type
+ schema:
type: string
- state_name:
+ - name: filter
+ in: query
+ description: ''
+ example: option_type_id_eq=1&name_cont=M
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Records returned
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ - id: '1'
+ type: option_value
+ attributes:
+ position: 1
+ name: Size-1
+ presentation: S
+ created_at: '2021-08-18T07:08:31.178Z'
+ updated_at: '2021-08-18T07:08:31.178Z'
+ relationships:
+ option_type:
+ data:
+ id: '1'
+ type: option_type
+ - id: '2'
+ type: option_value
+ attributes:
+ position: 1
+ name: Size-2
+ presentation: S
+ created_at: '2021-08-18T07:08:31.184Z'
+ updated_at: '2021-08-18T07:08:31.184Z'
+ relationships:
+ option_type:
+ data:
+ id: '2'
+ type: option_type
+ meta:
+ count: 2
+ total_count: 2
+ total_pages: 1
+ links:
+ self: http://www.example.com/api/v2/platform/option_values?page=1&per_page=&include=&filter=
+ next: http://www.example.com/api/v2/platform/option_values?include=&page=1&per_page=
+ prev: http://www.example.com/api/v2/platform/option_values?include=&page=1&per_page=
+ last: http://www.example.com/api/v2/platform/option_values?include=&page=1&per_page=
+ first: http://www.example.com/api/v2/platform/option_values?include=&page=1&per_page=
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ post:
+ summary: Creates an OptionValue
+ tags:
+ - OptionValues
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: option_type
+ schema:
+ type: string
+ responses:
+ '201':
+ description: record created
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: option_value
+ attributes:
+ position: 1
+ name: Size-5
+ presentation: S
+ created_at: '2021-08-18T07:08:31.265Z'
+ updated_at: '2021-08-18T07:08:31.265Z'
+ relationships:
+ option_type:
+ data:
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Name can't be blank and Presentation can't be blank
+ errors:
+ name:
+ - can't be blank
+ presentation:
+ - can't be blank
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/optionvalue_params"
+ "/api/v2/platform/option_values/{id}":
+ get:
+ summary: Returns an OptionValue
+ tags:
+ - OptionValues
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: option_type
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Record found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: option_value
+ attributes:
+ position: 1
+ name: Size-6
+ presentation: S
+ created_at: '2021-08-18T07:08:31.313Z'
+ updated_at: '2021-08-18T07:08:31.313Z'
+ relationships:
+ option_type:
+ data:
+ id: '1'
+ type: option_type
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ put:
+ summary: Updates an OptionValue
+ tags:
+ - OptionValues
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: option_type
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: option_value
+ attributes:
+ position: 1
+ name: M
+ presentation: S
+ created_at: '2021-08-18T07:08:31.392Z'
+ updated_at: '2021-08-18T07:08:31.403Z'
+ relationships:
+ option_type:
+ data:
+ id: '1'
+ type: option_type
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Name can't be blank
+ errors:
+ name:
+ - can't be blank
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/optionvalue_params"
+ delete:
+ summary: Deletes an OptionValue
+ tags:
+ - OptionValues
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: Record deleted
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/taxons":
+ get:
+ summary: Returns a list of Taxons
+ tags:
+ - Taxons
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: page
+ in: query
+ example: 1
+ schema:
+ type: integer
+ - name: per_page
+ in: query
+ example: 50
+ schema:
+ type: integer
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: taxonomy,parent,children
+ schema:
+ type: string
+ - name: filter
+ in: query
+ description: ''
+ example: taxonomy_id_eq=1&name_cont=Shirts
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Records returned
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ - id: '1'
+ type: taxon
+ attributes:
+ position: 0
+ name: taxonomy_16
+ permalink: taxonomy-16
+ lft: 1
+ rgt: 6
+ description:
+ created_at: '2021-08-18T07:08:31.598Z'
+ updated_at: '2021-08-18T07:08:31.660Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 0
+ pretty_name: taxonomy_16
+ seo_title: taxonomy_16
+ is_root: true
+ is_child: false
+ is_leaf: false
+ relationships:
+ parent:
+ data:
+ taxonomy:
+ data:
+ id: '1'
+ type: taxonomy
+ children:
+ data:
+ - id: '2'
+ type: taxon
+ - id: '3'
+ type: taxon
+ image:
+ data:
+ - id: '2'
+ type: taxon
+ attributes:
+ position: 0
+ name: taxon_16
+ permalink: taxonomy-16/taxon-16
+ lft: 2
+ rgt: 3
+ description:
+ created_at: '2021-08-18T07:08:31.623Z'
+ updated_at: '2021-08-18T07:08:31.626Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 1
+ pretty_name: taxonomy_16 -> taxon_16
+ seo_title: taxon_16
+ is_root: false
+ is_child: true
+ is_leaf: true
+ relationships:
+ parent:
+ data:
+ id: '1'
+ type: taxon
+ taxonomy:
+ data:
+ id: '1'
+ type: taxonomy
+ children:
+ data: []
+ image:
+ data:
+ id: '1'
+ type: taxon_image
+ - id: '3'
+ type: taxon
+ attributes:
+ position: 0
+ name: taxon_17
+ permalink: taxonomy-16/taxon-17
+ lft: 4
+ rgt: 5
+ description:
+ created_at: '2021-08-18T07:08:31.647Z'
+ updated_at: '2021-08-18T07:08:31.651Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 1
+ pretty_name: taxonomy_16 -> taxon_17
+ seo_title: taxon_17
+ is_root: false
+ is_child: true
+ is_leaf: true
+ relationships:
+ parent:
+ data:
+ id: '1'
+ type: taxon
+ taxonomy:
+ data:
+ id: '1'
+ type: taxonomy
+ children:
+ data: []
+ image:
+ data:
+ id: '2'
+ type: taxon_image
+ meta:
+ count: 3
+ total_count: 3
+ total_pages: 1
+ links:
+ self: http://www.example.com/api/v2/platform/taxons?page=1&per_page=&include=&filter=
+ next: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
+ prev: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
+ last: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
+ first: http://www.example.com/api/v2/platform/taxons?include=&page=1&per_page=
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ post:
+ summary: Creates a Taxon
+ tags:
+ - Taxons
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: taxonomy,parent,children
+ schema:
+ type: string
+ responses:
+ '201':
+ description: record created
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '2'
+ type: taxon
+ attributes:
+ position: 0
+ name: taxon_20
+ permalink: taxonomy-18/taxon-20
+ lft: 2
+ rgt: 3
+ description:
+ created_at: '2021-08-18T07:08:31.823Z'
+ updated_at: '2021-08-18T07:08:31.827Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 1
+ pretty_name: taxonomy_18 -> taxon_20
+ seo_title: taxon_20
+ is_root: false
+ is_child: true
+ is_leaf: true
+ relationships:
+ parent:
+ data:
+ id: '1'
+ type: taxon
+ taxonomy:
+ data:
+ id: '1'
+ type: taxonomy
+ children:
+ data: []
+ image:
+ data:
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Name can't be blank and Taxonomy can't be blank
+ errors:
+ name:
+ - can't be blank
+ taxonomy:
+ - can't be blank
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/taxon_params"
+ "/api/v2/platform/taxons/{id}":
+ get:
+ summary: Returns a Taxon
+ tags:
+ - Taxons
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: taxonomy,parent,children
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Record found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '2'
+ type: taxon
+ attributes:
+ position: 0
+ name: taxon_21
+ permalink: taxonomy-19/taxon-21
+ lft: 2
+ rgt: 3
+ description:
+ created_at: '2021-08-18T07:08:31.918Z'
+ updated_at: '2021-08-18T07:08:31.921Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 1
+ pretty_name: taxonomy_19 -> taxon_21
+ seo_title: taxon_21
+ is_root: false
+ is_child: true
+ is_leaf: true
+ relationships:
+ parent:
+ data:
+ id: '1'
+ type: taxon
+ taxonomy:
+ data:
+ id: '1'
+ type: taxonomy
+ children:
+ data: []
+ products:
+ data: []
+ image:
+ data:
+ id: '1'
+ type: taxon_image
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ put:
+ summary: Updates a Taxon
+ tags:
+ - Taxons
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: taxonomy,parent,children
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '2'
+ type: taxon
+ attributes:
+ position: 0
+ name: T-Shirts
+ permalink: taxonomy-21/taxon-23
+ lft: 2
+ rgt: 3
+ description:
+ created_at: '2021-08-18T07:08:32.084Z'
+ updated_at: '2021-08-18T07:08:32.108Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 1
+ pretty_name: taxonomy_21 -> T-Shirts
+ seo_title: T-Shirts
+ is_root: false
+ is_child: true
+ is_leaf: true
+ relationships:
+ parent:
+ data:
+ id: '1'
+ type: taxon
+ taxonomy:
+ data:
+ id: '1'
+ type: taxonomy
+ children:
+ data: []
+ image:
+ data:
+ id: '1'
+ type: taxon_image
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Name can't be blank
+ errors:
+ name:
+ - can't be blank
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/taxon_params"
+ delete:
+ summary: Deletes a Taxon
+ tags:
+ - Taxons
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: Record deleted
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/users":
+ get:
+ summary: Returns a list of Users
+ tags:
+ - Users
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: page
+ in: query
+ example: 1
+ schema:
+ type: integer
+ - name: per_page
+ in: query
+ example: 50
+ schema:
+ type: integer
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: ship_address,bill_address
+ schema:
+ type: string
+ - name: filter
+ in: query
+ description: ''
+ example: user_id_eq=1&[email protected]
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Records returned
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ - id: '1'
+ type: user
+ attributes:
+ created_at: '2021-08-18T07:08:32.466Z'
+ updated_at: '2021-08-18T07:08:32.466Z'
+ relationships:
+ bill_address:
+ data:
+ ship_address:
+ data:
+ - id: '2'
+ type: user
+ attributes:
+ created_at: '2021-08-18T07:08:32.475Z'
+ updated_at: '2021-08-18T07:08:32.475Z'
+ relationships:
+ bill_address:
+ data:
+ ship_address:
+ data:
+ - id: '3'
+ type: user
+ attributes:
+ created_at: '2021-08-18T07:08:32.477Z'
+ updated_at: '2021-08-18T07:08:32.477Z'
+ relationships:
+ bill_address:
+ data:
+ ship_address:
+ data:
+ meta:
+ count: 3
+ total_count: 3
+ total_pages: 1
+ links:
+ self: http://www.example.com/api/v2/platform/users?page=1&per_page=&include=&filter=
+ next: http://www.example.com/api/v2/platform/users?include=&page=1&per_page=
+ prev: http://www.example.com/api/v2/platform/users?include=&page=1&per_page=
+ last: http://www.example.com/api/v2/platform/users?include=&page=1&per_page=
+ first: http://www.example.com/api/v2/platform/users?include=&page=1&per_page=
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ post:
+ summary: Creates an User
+ tags:
+ - Users
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: ship_address,bill_address
+ schema:
+ type: string
+ responses:
+ '201':
+ description: record created
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '2'
+ type: user
+ attributes:
+ created_at: '2021-08-18T07:08:32.569Z'
+ updated_at: '2021-08-18T07:08:32.569Z'
+ relationships:
+ bill_address:
+ data:
+ ship_address:
+ data:
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Bill address belongs to other user
+ errors:
+ bill_address_id:
+ - belongs to other user
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/user_params"
+ "/api/v2/platform/users/{id}":
+ get:
+ summary: Returns an User
+ tags:
+ - Users
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: ship_address,bill_address
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Record found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '2'
+ type: user
+ attributes:
+ created_at: '2021-08-18T07:08:32.634Z'
+ updated_at: '2021-08-18T07:08:32.634Z'
+ relationships:
+ bill_address:
+ data:
+ ship_address:
+ data:
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ put:
+ summary: Updates an User
+ tags:
+ - Users
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: ship_address,bill_address
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '2'
+ type: user
+ attributes:
+ created_at: '2021-08-18T07:08:32.732Z'
+ updated_at: '2021-08-18T07:08:32.742Z'
+ relationships:
+ bill_address:
+ data:
+ ship_address:
+ data:
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Bill address belongs to other user
+ errors:
+ bill_address_id:
+ - belongs to other user
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/user_params"
+ delete:
+ summary: Deletes an User
+ tags:
+ - Users
+ security:
+ - bearer_auth: []
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: Record deleted
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+servers:
+- url: https://{defaultHost}
+ variables:
+ defaultHost:
+ default: localhost:3000
+components:
+ securitySchemes:
+ bearer_auth:
+ type: http
+ scheme: bearer
+ schemas:
+ address_params:
+ type: object
+ properties:
+ country_id:
+ type: string
+ state_id:
+ type: string
+ state_name:
type: string
address1:
type: string
@@ -1405,11 +2297,52 @@ components:
type: string
position:
type: integer
+ option_type_params:
+ type: object
+ properties:
+ name:
+ type: string
+ presentation:
+ type: string
+ required:
+ - name
+ - presentation
+ option_value_params:
+ type: object
+ properties:
+ name:
+ type: string
+ presentation:
+ type: string
+ option_values_attributes:
+ type: string
+ required:
+ - name
+ - presentation
+ user_params:
+ type: object
+ properties:
+ email:
+ type: string
+ password:
+ type: string
+ password_confirmation:
+ type: string
+ ship_address_id:
+ type: string
+ bill_address_id:
+ type: string
+ required:
+ - email
+ - password
+ - password_confirmation
taxon_params:
type: object
properties:
taxonomy_id:
type: string
+ parent_id:
+ type: string
name:
type: string
required:
diff --git a/api/lib/spree/api/testing_support/v2/platform_contexts.rb b/api/lib/spree/api/testing_support/v2/platform_contexts.rb
index fc5f80598a..78d95557cc 100644
--- a/api/lib/spree/api/testing_support/v2/platform_contexts.rb
+++ b/api/lib/spree/api/testing_support/v2/platform_contexts.rb
@@ -199,7 +199,7 @@ shared_examples 'DELETE record' do |resource_name|
end
shared_examples 'CRUD examples' do |resource_name, include_example, filter_example|
- resource_path = resource_name.pluralize.parameterize
+ resource_path = resource_name.tableize.pluralize
path "/api/v2/platform/#{resource_path}" do
include_examples 'GET records list', resource_name, include_example, filter_example
diff --git a/api/spec/integration/api/v2/platform/option_types_spec.rb b/api/spec/integration/api/v2/platform/option_types_spec.rb
new file mode 100644
index 0000000000..7cb6077cbd
--- /dev/null
+++ b/api/spec/integration/api/v2/platform/option_types_spec.rb
@@ -0,0 +1,26 @@
+require 'swagger_helper'
+
+describe 'Option Types API', swagger: true do
+ include_context 'Platform API v2'
+
+ resource_name = 'OptionType'
+ include_example = ''
+ filter_example = 'option_type_id_eq=1&name_cont=Size'
+
+ let(:id) { create(:option_type).id }
+ let(:option_type) { create(:option_type) }
+ let(:records_list) { create_list(:option_type, 2) }
+ let(:valid_create_param_value) { build(:option_type).attributes }
+ let(:valid_update_param_value) do
+ {
+ name: 'Size-X'
+ }
+ end
+ let(:invalid_param_value) do
+ {
+ name: '',
+ }
+ end
+
+ include_examples 'CRUD examples', resource_name, include_example, filter_example
+end
diff --git a/api/spec/integration/api/v2/platform/option_values_spec.rb b/api/spec/integration/api/v2/platform/option_values_spec.rb
new file mode 100644
index 0000000000..b10adce59e
--- /dev/null
+++ b/api/spec/integration/api/v2/platform/option_values_spec.rb
@@ -0,0 +1,26 @@
+require 'swagger_helper'
+
+describe 'Option Values API', swagger: true do
+ include_context 'Platform API v2'
+
+ resource_name = 'OptionValue'
+ include_example = 'option_type'
+ filter_example = 'option_type_id_eq=1&name_cont=M'
+
+ let(:id) { create(:option_value).id }
+ let(:option_type) { create(:option_value) }
+ let(:records_list) { create_list(:option_value, 2) }
+ let(:valid_create_param_value) { build(:option_value).attributes }
+ let(:valid_update_param_value) do
+ {
+ name: 'M'
+ }
+ end
+ let(:invalid_param_value) do
+ {
+ name: '',
+ }
+ end
+
+ include_examples 'CRUD examples', resource_name, include_example, filter_example
+end
diff --git a/api/spec/integration/api/v2/platform/users_spec.rb b/api/spec/integration/api/v2/platform/users_spec.rb
new file mode 100644
index 0000000000..bd1409b41f
--- /dev/null
+++ b/api/spec/integration/api/v2/platform/users_spec.rb
@@ -0,0 +1,28 @@
+require 'swagger_helper'
+
+describe 'Users API', swagger: true do
+ include_context 'Platform API v2'
+
+ resource_name = 'User'
+ include_example = 'ship_address,bill_address'
+ filter_example = 'user_id_eq=1&[email protected]'
+
+ let(:id) { create(:user).id }
+ let(:option_type) { create(:user, store: store) }
+ let(:records_list) { create_list(:user, 2) }
+ let(:valid_create_param_value) { build(:user).attributes }
+ let(:valid_update_param_value) do
+ {
+ }
+ end
+
+ let!(:bill_address) { create(:address, user: create(:user)) }
+ let(:invalid_param_value) do
+ {
+ bill_address_id: bill_address.id
+ }
+ end
+
+ include_examples 'CRUD examples', resource_name, include_example, filter_example
+end
diff --git a/api/spec/swagger_helper.rb b/api/spec/swagger_helper.rb
index aa369b0670..4f097025b4 100644
--- a/api/spec/swagger_helper.rb
+++ b/api/spec/swagger_helper.rb
@@ -68,6 +68,34 @@ RSpec.configure do |config|
position: { type: :integer }
}
},
+ option_type_params: {
+ type: :object,
+ properties: {
+ name: { type: :string },
+ presentation: { type: :string }
+ },
+ required: %w[name presentation]
+ },
+ option_value_params: {
+ type: :object,
+ properties: {
+ name: { type: :string },
+ presentation: { type: :string },
+ option_values_attributes: { type: :string }
+ },
+ required: %w[name presentation]
+ },
+ user_params: {
+ type: :object,
+ properties: {
+ email: { type: :string },
+ password: { type: :string },
+ password_confirmation: { type: :string },
+ ship_address_id: { type: :string },
+ bill_address_id: { type: :string },
+ },
+ required: %w[email password password_confirmation]
+ },
taxon_params: {
type: :object,
properties: {