Skip to content

Google Cloud Retail: updateMask values must be snake_case despite being camelCase on the Product Interface #4195

Closed

Description

@PedroS11

Hey everyone, I was using this package and found some struggles and thought about a suggestion to the documentation around the ProductService methods on Google Cloud Retail.

Basically, there's an interface called IProduct that represents a product on Cloud Retail Service (CRS) that has all its properties in camelCase. The issue is, when you want to partially update a product, you need to specify in a property called updateMaskan array of strings that represents the properties to be updated and they MUST be in snake_case and not on camelCase like in the product interface.

This is what I needed to send on the updateProduct method to have a successful request

const request: IUpdateProductRequest ={
  "product": {
    "colorInfo": { <---- in camelCase
      "colors": [
        "aaa"
      ]
    },
    "priceInfo": {
      "priceRange": {
        "price": {
          "maximum": 210,
          "minimum": 190
        }
      }
    },
    "name": "projects/YOUR_PROJECT/locations/global/catalogs/default_catalog/branches/1/products/PRODUCT_ID"
  },
  "allowMissing": true,
  "updateMask": {
    "paths": [
      "color_info.colors", <----- in snake_case
      "price_info.price_range.price.maximum",
      "price_info.price_range.price.minimum"
    ]
  }
};

And in the documentation, there's no reference to this difference.
Plus, another struggled I got was, to using updateProduct, getProduct, the property name is the full path (with location+catalog + branch+product) and not the product name. For the importProducts there's a parent proper for this but it's better documented on what should be value.

Hope it helps other people in the future that face the same issue :D

Activity

  1. added
    type: docsImprovement to the documentation for an API.
    priority: p3Desirable enhancement or fix. May not be included in next release.
    api: retailIssues related to the Retail API API.
    on Apr 21, 2023
  2. self-assigned this
    on Apr 27, 2023
  3. sofisl commented on Apr 27, 2023

    @sofisl
    Contributor

    Hey @PedroS11, I will open an issue here: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/main/retail.

    The sample you linked is autogenerated, and isn't guaranteed to work. However, the handwritten samples should contain this detail.

    Thank you for submitting this issue!

  4. PedroS11 commented on Apr 27, 2023

    @PedroS11
    Author

    Thank you so much for noticing this and for the quick move with the issue!
    Just another note, I didn't know this repo existed with samples as I was using an old one. Is it possible to add to this Google Cloud Node one any reference to those samples in the README, please? There're not many answers on stackoverflow or much info about the client on the official website so any documentation/examples will help everyone.

    Thank you !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: retailIssues related to the Retail API API.priority: p3Desirable enhancement or fix. May not be included in next release.type: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions