Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add descriptions for Money types; improve formatting
Marcin Gębalac79dc4bf3cc3
diff --git a/saleor/graphql/core/types.py b/saleor/graphql/core/types.pyindex 1247aa6d7f..471a418622 100644--- a/saleor/graphql/core/types.py+++ b/saleor/graphql/core/types.py@@ -39,29 +39,34 @@ class Error(graphene.ObjectType):class Money(graphene.ObjectType):- currency = graphene.String()- amount = graphene.Float()- localized = graphene.String()+ currency = graphene.String(description='Currency code.')+ amount = graphene.Float(description='Amount of money.')+ localized = graphene.String(+ description='Money formatted according to the current locale.')class Meta:- description = 'Basic representation of money.'+ description = 'Represents amount of money in specific currency.'def resolve_localized(self, info):return prices_i18n.amount(self)class TaxedMoney(graphene.ObjectType):- currency = graphene.String()- gross = graphene.Field(Money)- net = graphene.Field(Money)+ gross = graphene.Field(+ Money, description='Amount of money including taxes.')+ net = graphene.Field(Money, description='Amount of money without taxes.')class Meta:- description = 'Monetary value including '+ description = """Represents a monetary value with taxes. In+ case when taxes were not applied, net and gross values will be equal.+ """class TaxedMoneyRange(graphene.ObjectType):- start = graphene.Field(TaxedMoney)- stop = graphene.Field(TaxedMoney)+ start = graphene.Field(+ TaxedMoney, description='Lower bound of a price range.')+ stop = graphene.Field(+ TaxedMoney, description='Upper bound of a price range.')class Meta:description = 'Represents a range of monetary values.'diff --git a/saleor/graphql/page/types.py b/saleor/graphql/page/types.pyindex e566a0e70e..f6c5001522 100644--- a/saleor/graphql/page/types.py+++ b/saleor/graphql/page/types.py@@ -6,10 +6,8 @@ from ..core.types import CountableDjangoObjectTypeclass Page(CountableDjangoObjectType):class Meta:- description = """- A static page that can be manually added by staff users through- the dashboard.- """+ description = """A static page that can be manually added by a shop+ operator through the dashboard."""model = models.Pageinterfaces = [relay.Node]diff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.pyindex 9248386692..0161498971 100644--- a/saleor/graphql/product/types.py+++ b/saleor/graphql/product/types.py@@ -31,16 +31,15 @@ class ProductVariant(CountableDjangoObjectType):description='Quantity of a product available for sale.')price_override = graphene.Field(Money,- description="""- Override the base price of a product if necessary. A value of `null`- indicates the the default product price is used.""")+ description="""Override the base price of a product if necessary.+ A value of `null` indicates the the default product price is used.""")attributes = graphene.List(SelectedAttribute,description='List of attributes assigned to this variant.')class Meta:- description = """- Represents a version of a product such as different size or color."""+ description = """Represents a version of a product such as different+ size or color."""interfaces = [relay.Node]model = models.ProductVariant@@ -75,20 +74,19 @@ class Product(CountableDjangoObjectType):description='Size of a thumbnail, for example 255x255.'))availability = graphene.Field(ProductAvailability,- description="""- Informs about product's availability in the storefront, current price- and discounts.""")+ description="""Informs about product's availability in the storefront,+ current price and discounts.""")price = graphene.Field(Money,- description="""- The product's base price (without any discounts applied).""")+ description="""The product's base price (without any discounts+ applied).""")attributes = graphene.List(SelectedAttribute,description='List of product attributes assigned to this product.')class Meta:- description = """- Represents an individual item for sale in the storefront."""+ description = """Represents an individual item for sale in the+ storefront."""interfaces = [relay.Node]model = models.Product@@ -116,9 +114,8 @@ class ProductType(CountableDjangoObjectType):description='List of products of this type.')class Meta:- description = """- Represents a type of product. It defines what attributes are available- to products of this type."""+ description = """Represents a type of product. It defines what+ attributes are available to products of this type."""interfaces = [relay.Node]model = models.ProductType@@ -137,10 +134,9 @@ class Category(CountableDjangoObjectType):description='List of children of the category.')class Meta:- description = """- Represents a single category of products. Categories allow to organize- products in a tree-hierarchies which can be used for navigation in the- storefront."""+ description = """Represents a single category of products. Categories+ allow to organize products in a tree-hierarchies which can be used for+ navigation in the storefront."""exclude_fields = ['lft', 'rght', 'tree_id']interfaces = [relay.Node]filter_fields = ['id', 'name']@@ -193,9 +189,9 @@ class ProductAttribute(CountableDjangoObjectType):ProductAttributeValue, description='List of attribute\'s values.')class Meta:- description = """- Custom attribute of a product. Attributes can be dynamically assigned- to products and variants at the product type level."""+ description = """Custom attribute of a product. Attributes can be+ dynamically assigned to products and variants at the product type+ level."""exclude_fields = ['product_types', 'product_variant_types']interfaces = [relay.Node]filter_fields = ['id', 'slug']