Skip to content

Commit

Permalink
Updated API from documentation release
Browse files Browse the repository at this point in the history
  • Loading branch information
Auto Mation committed Dec 18, 2023
1 parent 70d15e1 commit 8f05884
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 30 deletions.
8 changes: 7 additions & 1 deletion api-specs/frontend-api/api.raml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ types:
Tastic: !include types/Tastic.raml
TasticConfiguration: !include types/TasticConfiguration.raml
ViewData: !include types/ViewData.raml

BuildUpload: !include types/BuildUpload.raml
BuildMetadata: !include types/BuildMetadata.raml
BuildUploadResult: !include types/BuildUploadResult.raml
traits:
right-header:
headers:
Expand Down Expand Up @@ -82,3 +84,7 @@ traits:
/preview: !include resources/FrontasticPreview.raml
/action: !include resources/FrontasticAction.raml
/data-source: !include resources/FrontasticDataSource.raml

/api:
/build:
/upload: !include resources/BuildUpload.raml
11 changes: 11 additions & 0 deletions api-specs/frontend-api/examples/build-upload-metadata-payload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"branch": "main",
"revision": "a594ac3df6506a04e041de2b2d7ca5bf813fd602",
"versionNumber": "2023.07.18.13.28",
"nodeJsVersion": 18,
"buildSuccessful": true,
"buildTime": "2023-11-21T08:14:31.830Z",
"buildDuration": 300,
"buildLog": "Build started...\nDependencies installed...\nBuild completed successfully!",
"deploy": true
}
4 changes: 4 additions & 0 deletions api-specs/frontend-api/examples/build-upload-success.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "Upload successful.",
"status": "success"
}
13 changes: 13 additions & 0 deletions api-specs/frontend-api/resources/BuildUpload.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#%RAML 1.0 ResourceType

post:
description: Uploads your backend builds from your custom CI environment to the Studio.
body:
multipart/form-data:
type: BuildUpload
responses:
200:
body:
application/json:
type: object
example: !include ../examples/build-upload-success.json
70 changes: 41 additions & 29 deletions api-specs/frontend-api/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,46 @@
<name>default</name>
<apply set="default"/>
<rules>
<rule>
<name>com.commercetools.rmf.validators.ResourcePluralRule</name>
<options>
<option type="exclude">context</option>
<option type="exclude">page</option>
<option type="exclude">preview</option>
<option type="exclude">action</option>
<option type="exclude">frontastic</option>
<option type="exclude">data-source</option>
</options>
</rule>
<rule>
<name>com.commercetools.rmf.validators.UnionTypePropertyRule</name>
<options>
<option type="exclude">//</option>
</options>
</rule>
<rule enabled="false">
<name>com.commercetools.rmf.validators.DatetimeRule</name>
</rule>
<rule enabled="false">
<name>com.commercetools.rmf.validators.SdkBaseUriRule</name>
</rule>
<rule>
<name>com.commercetools.rmf.validators.NamedStringEnumRule</name>
<options>
<option type="exclude">Locale</option>
</options>
</rule>
<rule>
<name>com.commercetools.rmf.validators.ResourcePluralRule</name>
<options>
<option type="exclude">api</option>
<option type="exclude">build</option>
<option type="exclude">upload</option>
<option type="exclude">data-source</option>
<option type="exclude">action</option>
<option type="exclude">preview</option>
<option type="exclude">page</option>
<option type="exclude">context</option>
<option type="exclude">frontastic</option>
</options>
</rule>
<rule enabled="false">
<name>com.commercetools.rmf.validators.SdkBaseUriRule</name>
</rule>
<rule>
<name>com.commercetools.rmf.validators.UnionTypePropertyRule</name>
<options>
<option type="exclude">//</option>
</options>
</rule>
<rule>
<name>com.commercetools.rmf.validators.CamelCaseRule</name>
<options>
<option type="exclude">extension_map</option>
</options>
</rule>
<rule>
<name>com.commercetools.rmf.validators.NamedStringEnumRule</name>
<options>
<option type="exclude">Locale</option>
</options>
</rule>
<rule>
<name>com.commercetools.rmf.validators.StringPropertySingularRule</name>
<options>
<option type="exclude">status</option>
</options>
</rule>
</rules>
</ruleset>
38 changes: 38 additions & 0 deletions api-specs/frontend-api/types/BuildMetadata.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#%RAML 1.0 DataType
(package): Common
displayName: BuildMetadata
type: object
properties:
branch:
type: string
description: Name of the Git branch to deploy.
revision:
type: string
description: Full commit ID hash of the current HEAD.
versionNumber:
type: string
description: Current time represented in the format `YYYY.MM.DD.HH.mm`. This value should be unique and sortable.
nodeJsVersion:
type: integer
description: Node.js version for the [Extension runner](/../frontend-getting-started/development-concepts#extension-runner).
default: 18
required: false
buildSuccessful:
type: boolean
description: |
If `true`, the build is marked as successful and [displayed in the Studio](/../frontend-studio/using-deployment-in-the-studio).
buildTime:
type: string
description: Date and time of the build in the [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339) format. For example, `2023-11-21T08:14:31.830Z`.
buildDuration:
type: integer
description: Build duration in seconds.
buildLog:
type: string
description: CI execution logs.
deploy:
type: boolean
description: |
If `true`, the build is automatically deployed to the staging environment, if `buildSuccessful` is `true`.
default: false
required: false
20 changes: 20 additions & 0 deletions api-specs/frontend-api/types/BuildUpload.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#%RAML 1.0 DataType
(package): Common
displayName: BuildUpload
type: object
properties:
metadata:
description: Metadata about the build.
type: BuildMetadata
required: true
example: !include ../examples/build-upload-metadata-payload.json
extension:
description: Javascript bundle containing all code of the backend extensions.
type: file
required: true
fileTypes: ['*.js']
extension_map:
description: Map for the build file. When provided, exceptions will be logged with readable stack traces.
type: file
required: false
fileTypes: ['*.js.map']
14 changes: 14 additions & 0 deletions api-specs/frontend-api/types/BuildUploadResult.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#%RAML 1.0 DataType
(package): Common
displayName: BuildUploadResult
type: object
properties:
status:
type: string
description: Status of the build.
enum:
- success
- failure
message:
type: string
description: Description of the upload result.

0 comments on commit 8f05884

Please sign in to comment.