Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add identifier field to app object (#14869)

Lukasz Ostrowskib8523895a2c7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2fd76f4441..59f334677a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Add taxes to undiscounted prices - #14095 by @jakubkuc
- Mark as deprecated: `ordersTotal`, `reportProductSales` and `homepageEvents` - #14806 by @8r2y5
+- Add `identifier` field to App graphql object. Identifier field is the same as Manifest.id field (explicit ID set by the app).
### Saleor Apps
diff --git a/saleor/graphql/app/tests/queries/test_app.py b/saleor/graphql/app/tests/queries/test_app.py
index e640df8628..ee617b2e12 100644
--- a/saleor/graphql/app/tests/queries/test_app.py
+++ b/saleor/graphql/app/tests/queries/test_app.py
@@ -14,6 +14,7 @@ QUERY_APP = """
query ($id: ID){
app(id: $id){
id
+ identifier
created
isActive
permissions{
@@ -82,6 +83,7 @@ def test_app_query(
app.permissions.add(permission_manage_staff)
app.store_value_in_metadata({"test": "123"})
app.author = "Acme Ltd"
+ app.identifier = "saleor.app.mock"
app.save()
webhook = webhook
@@ -128,6 +130,7 @@ def test_app_query(
assert app_data["metadata"][0]["value"] == "123"
assert app_data["metafield"] == "123"
assert app_data["metafields"] == {"test": "123"}
+ assert app_data["identifier"] == "saleor.app.mock"
def test_app_query_no_permission(
diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.py
index f8da0a36e3..36de29bb9c 100644
--- a/saleor/graphql/app/types.py
+++ b/saleor/graphql/app/types.py
@@ -29,6 +29,7 @@ from ..core.descriptions import (
ADDED_IN_38,
ADDED_IN_313,
ADDED_IN_314,
+ ADDED_IN_319,
DEPRECATED_IN_3X_FIELD,
PREVIEW_FEATURE,
)
@@ -492,6 +493,9 @@ class AppToken(BaseObjectType):
@federated_entity("id")
class App(ModelObjectType[models.App]):
id = graphene.GlobalID(required=True, description="The ID of the app.")
+ identifier = graphene.String(
+ required=False, description="Canonical app ID from the manifest" + ADDED_IN_319
+ )
permissions = NonNullList(Permission, description="List of the app's permissions.")
created = graphene.DateTime(
description="The date and time when the app was created."
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 2ecc773647..53e2fa0335 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -3069,6 +3069,13 @@ type App implements Node & ObjectWithMetadata @doc(category: "Apps") {
"""
metafields(keys: [String!]): Metadata
+ """
+ Canonical app ID from the manifest
+
+ Added in Saleor 3.19.
+ """
+ identifier: String
+
"""List of the app's permissions."""
permissions: [Permission!]