Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/theme-duplicate-json-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli': major
---

Use string IDs, camelCase resources, cancellation results, and fatal error envelopes for `theme duplicate --json`.
326 changes: 312 additions & 14 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10750,24 +10750,322 @@ DESCRIPTION
If you use the `--json` flag, then theme information is returned in JSON format, which can be used as a
machine-readable input for scripts or continuous integration.

Sample JSON output:
Successful JSON results include `status`, `changed`, and explicit `originalTheme` and `theme` resources with decimal
string IDs. Failures use the shared `{error}` document.

```json
{
"theme": {
"id": 108267175958,
"name": "A Duplicated Theme",
"role": "unpublished",
"shop": "mystore.myshopify.com"
}
}
```
Use `--json-schema` to print the result, error, and event schemas.

Output from `--json` conforms to the `ThemeDuplicateResult` schema.

```json
{
"message": "The theme 'Summer Edition' could not be duplicated due to errors",
"errors": ["Maximum number of themes reached"],
"requestId": "12345-abcde-67890"
"anyOf": [
{
"$ref": "#/definitions/ThemeEnvironment/anyOf/0/properties/result"
},
{
"type": "object",
"properties": {
"environments": {
"type": "array",
"items": {
"$ref": "#/definitions/ThemeEnvironment"
}
}
},
"required": [
"environments"
],
"additionalProperties": false
}
],
"title": "ThemeDuplicateResult",
"definitions": {
"Theme": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^\\d+$",
"description": "The decimal Online Store theme ID, not a Shopify GID."
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"description": "The upstream theme role; known values include live, unpublished, and development."
}
},
"required": [
"id",
"name",
"role"
],
"additionalProperties": false
},
"ThemeEnvironment": {
"anyOf": [
{
"type": "object",
"properties": {
"environment": {
"type": "string"
},
"result": {
"anyOf": [
{
"type": "object",
"properties": {
"status": {
"type": "string",
"const": "success"
},
"changed": {
"type": "boolean"
},
"originalTheme": {
"$ref": "#/definitions/Theme"
},
"theme": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/Theme/properties/id"
},
"name": {
"$ref": "#/definitions/Theme/properties/name"
},
"role": {
"$ref": "#/definitions/Theme/properties/role"
},
"storeDomain": {
"anyOf": [
{
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]*\\.myshopify\\.com$"
},
{
"type": "null"
}
]
},
"previewUrl": {
"anyOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"name",
"role",
"storeDomain",
"previewUrl"
],
"additionalProperties": false
}
},
"required": [
"status",
"changed",
"originalTheme",
"theme"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"status": {
"type": "string",
"const": "cancelled"
}
},
"required": [
"status"
],
"additionalProperties": false
}
]
}
},
"required": [
"environment",
"result"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"environment": {
"type": "string"
},
"error": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "abort"
},
"message": {
"type": "string"
},
"code": {
"type": "string",
"minLength": 1,
"description": "A stable error code, included only when known."
},
"tryMessage": {
"type": "string"
},
"nextSteps": {
"type": "array",
"items": {
"type": "string"
}
},
"customSections": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"body": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
}
]
}
},
"required": [
"body"
],
"additionalProperties": false
}
},
"details": {
"description": "Selected domain details, preserving native API payloads such as GraphQL errors, extensions, and data."
}
},
"required": [
"type",
"message"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "bug"
},
"message": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/message"
},
"code": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/code"
},
"tryMessage": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/tryMessage"
},
"nextSteps": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/nextSteps"
},
"customSections": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/customSections"
},
"details": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/details"
},
"stack": {
"type": "string"
}
},
"required": [
"type",
"message"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "external"
},
"message": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/message"
},
"code": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/code"
},
"tryMessage": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/tryMessage"
},
"nextSteps": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/nextSteps"
},
"customSections": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/customSections"
},
"details": {
"$ref": "#/definitions/ThemeEnvironment/anyOf/1/properties/error/anyOf/0/properties/details"
},
"command": {
"type": "string"
},
"args": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"type",
"message",
"command",
"args"
],
"additionalProperties": false
}
]
}
},
"required": [
"environment",
"error"
],
"additionalProperties": false
}
]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
```
```
Expand Down
Loading
Loading