Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Conversation

VoronoyAlexandr
Copy link
Contributor

Description

The schema has no 'id' field.

Fixed Issues (if relevant)

Added 'option_id' field in schema.

Manual testing scenarios

Query:

  products(filter: {sku: {eq: "simple"}}) {
    items {
      id
      attribute_set_id
      created_at
      name
      sku
      type_id
      updated_at
      ... on CustomizableProductInterface {
        options {
          title
          required
          sort_order
          option_id
        }
      }
    }
  }
}

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@VoronoyAlexandr VoronoyAlexandr self-assigned this Nov 12, 2018
@@ -358,6 +358,7 @@ interface CustomizableOptionInterface @typeResolver(class: "Magento\\CatalogGrap
title: String @doc(description: "The display name for this option")
required: Boolean @doc(description: "Indicates whether the option is required")
sort_order: Int @doc(description: "The order in which the option is displayed")
option_id: Int @doc(description: "Option ID")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VoronoyAlexandr Why does option_id need to be exposed? Please provide scenario, which requires this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good day @paliarush.
Scenario:
If we used mutation to add product in cart with options like in this code

mutation {
  addSimpleProductsToCart(
    input: {
      cart_id: "CDNuOMoQBV3CElFSUbgbAswlVcoaeSId", 
      cartItems: [
        {
          data: {
            sku: "product_dynamic_1", 
            qty: 1
          }, 
          customizable_options: [
            {id: 5, value: "4"},
            {id: 6, value: "5"}
          ]
        }
      ]
    }
  ) 
.......

we need know what is id of options. At this moment schema return only 'title', 'required', 'sort_order'. This option_id in schema, response look like:

{
  "data": {
    "products": {
      "items": [
        {
          "id": 1,
          "attribute_set_id": 10,
          "created_at": "2018-11-11 14:00:34",
          "name": "Simple Product 1",
          "sku": "product_dynamic_1",
          "type_id": "simple",
          "updated_at": "2018-11-13 09:25:55",
          "options": [
            {
              "title": "Test option 1",
              "required": true,
              "sort_order": 1,
              "option_id": 1
            },
            {
              "title": "Test option 2",
              "required": true,
              "sort_order": 2,
              "option_id": 3
            }
          ]
        }
      ]
    }
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants