magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Graphql products query returns only ids for dropdows or multiselect fields

Open maximilianmikus opened this issue 4 years ago • 29 comments

Preconditions (*)

  1. 2.3.5-p1 with sample data

Steps to reproduce (*)

  1. u can use this magento instance (https://magento2.kask.at/graphql) or your own testing instance with sample data. query /graphql for a product that has the gender attribute (multiselect) e.g. "dual-handle-cardio-ball"
query productDetail($url_key: String) {
  productDetail: products(filter: {url_key: {eq: $url_key}}) {
    items {
      name
      url_key
      gender
    }
  }
}

variables:

{
  "url_key": "dual-handle-cardio-ball"
}

Expected result (*)

I would expext the result to contain the labels

{
  "data": {
    "productDetail": {
      "items": [
        {
          "name": "Dual Handle Cardio Ball",
          "url_key": "dual-handle-cardio-ball",
          "gender": ["Men","Women","Unisex"]
        }
      ]
    }
  }
}

Actual result (*)

the response only returns the value ids.

{
  "data": {
    "productDetail": {
      "items": [
        {
          "name": "Dual Handle Cardio Ball",
          "url_key": "dual-handle-cardio-ball",
          "gender": "5507,5508,5511"
        }
      ]
    }
  }
}

maximilianmikus avatar May 12 '20 13:05 maximilianmikus

Hi @maximilianmikus. Thank you for your report. To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@maximilianmikus do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

m2-assistant[bot] avatar May 12 '20 13:05 m2-assistant[bot]

@magento give me 2.4-develop instance

maximilianmikus avatar May 12 '20 13:05 maximilianmikus

Magento instance deployment temporary unavailable due to service maintenance.

magento-engcom-team avatar May 12 '20 13:05 magento-engcom-team

@magento give me 2.4-develop instance

maximilianmikus avatar May 12 '20 19:05 maximilianmikus

Magento instance deployment temporary unavailable due to service maintenance.

magento-engcom-team avatar May 12 '20 19:05 magento-engcom-team

@magento give me 2.4-develop instance

maximilianmikus avatar May 13 '20 12:05 maximilianmikus

Magento instance deployment temporary unavailable due to service maintenance.

magento-engcom-team avatar May 13 '20 12:05 magento-engcom-team

@magento give me 2.4-develop instance

maximilianmikus avatar May 19 '20 08:05 maximilianmikus

Hi @maximilianmikus. Thank you for your request. I'm working on Magento 2.4-develop instance for you

magento-engcom-team avatar May 19 '20 08:05 magento-engcom-team

Hi @maximilianmikus, here is your Magento instance. Admin access: https://i-28200-2-4-develop.instances.magento-community.engineering/admin_b3e5 Login: cf115cc0 Password: 32c908c14326 Instance will be terminated in up to 3 hours.

magento-engcom-team avatar May 19 '20 08:05 magento-engcom-team

I can confirm this happens on 2.4-develop

the query:

query productDetail($url_key: String) {
  productDetail: products(filter: {url_key: {eq: $url_key}}) {
    items {
      name
      url_key
      mycolor
      mysize
    }
  }
}

with variables

{
  "url_key": "simple-product-28"
}

yields

{
  "data": {
    "productDetail": {
      "items": [
        {
          "name": "Simple Product 28",
          "url_key": "simple-product-28",
          "mycolor": 6,
          "mysize": 9
        }
      ]
    }
  }
}

It should actually contain the labels. "my yellow" and "my large"

maximilianmikus avatar May 19 '20 08:05 maximilianmikus

Hi @paliarush. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Jun 11 '20 13:06 m2-assistant[bot]

Hi @danielrenaud. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Jun 11 '20 13:06 m2-assistant[bot]

Hi @sasha19957099. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Jun 24 '20 11:06 m2-assistant[bot]

It's really a good improvement however, unfortunately, it will bring breaking changes, so we cannot accept it for 2.4. (unless it will be approved)

Maybe we can do the following: mark all dynamic product attributes as deprecated and introduce an object that will hold all dynamic product attributes, something like

dynamic_attributes: [
    {
       code
       value
       type // is it useful for rendering UI?
    }
]

Only one drawback that we need to support different types like texts, lists, float.. (we can see them in Admin => Store => Attributes => Product) and we can agree to have "value" as an array of strings which will cover all cases, however on the client-side we need to have something like value[0] each time for one-value attributes.

@DrewML what do you think about it?

mslabko avatar Aug 06 '20 21:08 mslabko

This is an interesting one! I believe we've discussed before that, ideally, we'd get rid of attributes as fields, since it makes breaking change detection and multi-store frontends difficult to do.

I believe the general idea has been to go with something like you've recommended @mslabko. Will probably take a little bit of back and forth, though, to flesh out the right design.

In the meantime, it seems like this reported issue (a String returning a comma-delimited list of IDs) certainly has to be a bug, which may make it ok to fix in a non-major release.

Thoughts @nrkapoor?

DrewML avatar Aug 07 '20 19:08 DrewML

Hi @melnikovi. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Aug 15 '20 15:08 m2-assistant[bot]

I would like to kindly ask to make this high priority please - its really important otherwise product-information is not correctly displayed in the frontend. Could you maybe create a patch with some preliminary fix or something of the sort, while you sort out the better solutions. I tried doing this but lack deeper inside into the codebase to make it work.

maximilianmikus avatar Jan 05 '21 00:01 maximilianmikus

For anyone stuck here, try this quickfix till its resolved in the core.

theshreyas avatar Mar 06 '21 08:03 theshreyas

there was a typo in the link: https://github.com/theshreyas/magento-2-quickies/tree/main/GraphQl/DynamicAttributesGraphql

maximilianmikus avatar May 16 '21 20:05 maximilianmikus

Hi there, is there a patch or solusion for this now? Thanks

harrywutech avatar Sep 10 '21 22:09 harrywutech

Hi there, is there a patch or solusion for this now? Thanks

harrywutech avatar Oct 28 '21 21:10 harrywutech

/push

please set this to higher prio 🚀

maximilianmikus avatar Nov 01 '21 20:11 maximilianmikus

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2796 is successfully created for this GitHub issue.

https://jira.corp.adobe.com/browse/AC-2796

github-jira-sync-bot avatar Apr 08 '22 01:04 github-jira-sync-bot

:white_check_mark: Confirmed by @cpartica. Thank you for verifying the issue.
Issue Available: @cpartica, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Apr 08 '22 01:04 m2-assistant[bot]

hello, any idea on this issue and when its expected to be fixed ?

marwan-corals avatar Apr 21 '22 11:04 marwan-corals

@cpartica, as you mentioned in JIRA comment, that we need an approved schema for this one, and alignment with the pwa metapackage schema. This will take time and moving it to 2.4.6.

Hence moving the associated PR to on Hold, until the further updates on JIRA.

engcom-Charlie avatar May 23 '22 11:05 engcom-Charlie

Hi there, is there a patch or solusion for this now? Thanks

harrywutech avatar Jun 15 '22 18:06 harrywutech

Over 2 years and counting and still no good support for two entire fundamental attribute data types and the can continues to be kicked down the road.

GamesmenJordan avatar Jul 31 '22 12:07 GamesmenJordan

As mentioned in above https://github.com/magento/magento2/issues/28200#issuecomment-1134530825, we are doing follow up with team. We are waiting for the PO's input on the same. Once will get the clarity on that, we will proceed further on this.

Thank you!

engcom-Charlie avatar Oct 21 '22 09:10 engcom-Charlie