Skip to content

Commit

Permalink
Updated API from documentation release
Browse files Browse the repository at this point in the history
  • Loading branch information
ct-sdks[bot] committed Apr 22, 2024
1 parent e59c07a commit f39e14a
Show file tree
Hide file tree
Showing 21 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api-specs/api/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
<rule enabled="false">
<name>com.commercetools.rmf.validators.DatetimeRule</name>
</rule>
<rule enabled="true">
<name>com.commercetools.rmf.validators.PolymorphicSubtypesRule</name>
</rule>
<rule>
<name>com.commercetools.rmf.validators.CamelCaseRule</name>
<options>
Expand Down
3 changes: 3 additions & 0 deletions api-specs/api/types/annotations.raml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ package:
identifier:
type: boolean
allowedTargets: TypeDeclaration
ignoreValidators:
type: string[]
allowedTargets: TypeDeclaration
elementIdentifier:
type: boolean
allowedTargets: TypeDeclaration
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/common/BaseAddress.raml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description: |
Polymorphic base type that represents a postal address and contact details.
Depending on the read or write action, it can be either [Address](ctp:api:type:Address) or [AddressDraft](ctp:api:type:AddressDraft) that
only differ in the data type for the optional `custom` field.
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
id?:
type: string
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/common/BaseResource.raml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
displayName: BaseResource
type: object
(abstract): true
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
id:
(identifier): true
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/common/ClientLogging.raml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ displayName: ClientLogging
type: object
description: |
These objects represent information about which [API Client](/../api/projects/api-clients) created or modified a resource. For more information, see [Client Logging](/../api/general-concepts#client-logging).
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
clientId?:
type: string
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/common/Money.raml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type: object
description: |
Draft type that stores amounts only in cent precision for the specified currency.
example: !include ../../examples/Common/Money.json
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
centAmount:
type: number
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/error/ErrorResponse.raml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ displayName: ErrorResponse
description: |
Base representation of an error response containing common fields to all errors.
example: !include /../../examples/Error/ErrorResponse.json
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
statusCode:
type: integer
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/message/OrderMessage.raml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#%RAML 1.0 DataType
(package): Message
type: Message
(ignoreValidators): [PolymorphicSubtypesRule]
displayName: OrderMessage
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#%RAML 1.0 DataType
(package): Message
type: MessagePayload
(ignoreValidators): [PolymorphicSubtypesRule]
displayName: OrderMessagePayload
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
(package): Order
type: OrderSearchQuery
displayName: OrderSearchCompoundExpression
(ignoreValidators): [PolymorphicSubtypesRule]
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
(package): Order
type: OrderSearchQuery
displayName: OrderSearchQueryExpression
(ignoreValidators): [PolymorphicSubtypesRule]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(package): Order
type: object
displayName: OrderSearchQueryExpressionValue
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
field:
type: string
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/order/Order.raml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
displayName: Order
(updateType): OrderUpdate
type: BaseResource
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
id:
(identifier): true
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/order/OrderSearchQuery.raml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
(package): Order
type: object
displayName: OrderSearchQuery
(ignoreValidators): [PolymorphicSubtypesRule]
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
type: object
(beta): true
displayName: ProductSearchFacetExpression
(ignoreValidators): [PolymorphicSubtypesRule]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
displayName: ProductSearchFacetResult
type: object
(beta): true
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
name:
type: string
Expand Down
1 change: 1 addition & 0 deletions api-specs/api/types/search/SearchCompoundExpression.raml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
type: SearchQuery
(beta): true
displayName: SearchCompoundExpression
(ignoreValidators): [PolymorphicSubtypesRule]
1 change: 1 addition & 0 deletions api-specs/api/types/search/SearchQuery.raml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
type: object
(beta): true
displayName: SearchQuery
(ignoreValidators): [PolymorphicSubtypesRule]
1 change: 1 addition & 0 deletions api-specs/api/types/search/SearchQueryExpression.raml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
type: SearchQuery
(beta): true
displayName: SearchQueryExpression
(ignoreValidators): [PolymorphicSubtypesRule]
1 change: 1 addition & 0 deletions api-specs/api/types/search/SearchQueryExpressionValue.raml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
type: object
(beta): true
displayName: SearchQueryExpressionValue
(ignoreValidators): [PolymorphicSubtypesRule]
properties:
field:
type: string
Expand Down
30 changes: 30 additions & 0 deletions api-specs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,10 @@ This annotation is declared on the API settings level, so in the [api-specs/api/

Use this annotation to add descriptions to an enum property, like here [ChannelRoleEnum.raml](./api/types/channel/ChannelRoleEnum.raml).

##### (ignoreValidators)

Use this annotation to ignore the rules in this list for the specific type, resource or module.

### Composable Commerce API folder structure

#### /examples
Expand Down Expand Up @@ -1314,6 +1318,32 @@ resourceTypes:
get:
```

#### PolymorphicSubtypesRule

The rule verifies that a type defines a discriminator if it has subtypes to avoid issues with deserialization of read models.

```raml
types:
Foo:
type: object
discriminator: type
properties:
type: string
SubFoo:
discriminatorValue: sub
type: Foo
InvalidBar:
type: object
description: InvalidBar
properties:
name: string
SubBar:
description: SubBar
type: InvalidBar
SubBar2:
type: InvalidBar
```

# Generate a Postman Collection

Follow the steps in the [Generate a Postman Collection](https://github.com/commercetools/commercetools-docs/blob/main/api-specs/generate-a-postman-collection.md) guide to learn more.

0 comments on commit f39e14a

Please sign in to comment.