Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

ProductCatalogItem.StockState enum invalid #14

Closed
mdg41 opened this issue Oct 16, 2020 · 7 comments · Fixed by #22
Closed

ProductCatalogItem.StockState enum invalid #14

mdg41 opened this issue Oct 16, 2020 · 7 comments · Fixed by #22
Assignees
Labels
api: recommendationengine Issues related to the googleapis/python-recommendations-ai API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mdg41
Copy link

mdg41 commented Oct 16, 2020

IN_STOCK and STOCK_STATE_UNSPECIFIED both have a value of 0, without specifying allow_alias=True. This is causing deployment errors with protobuf.

The workaround is to specify no binary in requirements.txt:

protobuf==3.13.0 --no-binary=protobuf

Error

TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "google/cloud/recommendationengine_v1beta1/types/catalog.proto":
google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState: 
"google.cloud.recommendationengine.v1beta1.ProductCatalogItem.IN_STOCK" uses the same enum value as
"google.cloud.recommendationengine.v1beta1.ProductCatalogItem.STOCK_STATE_UNSPECIFIED". If this is
intended, set 'option allow_alias = true;' to the enum definition.

Docs
https://developers.google.com/protocol-buffers/docs/proto3

@product-auto-label product-auto-label bot added the api: recommendationengine Issues related to the googleapis/python-recommendations-ai API. label Oct 16, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Oct 17, 2020
@busunkim96
Copy link
Contributor

@busunkim96 busunkim96 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Oct 19, 2020
@matthiasa4
Copy link

Hi - I'm trying to use this library and having issues with calling a MessageToDict method on the CatalogItem, giving me:

  • KeyError: 'DESCRIPTOR'
  • AttributeError: 'DESCRIPTOR'
    errors. Any chance this might be related?

@busunkim96
Copy link
Contributor

@matthiasa4 That is likely unrelated. Serialization for the messages works a bit differently on the newer clients. See https://proto-plus-python.readthedocs.io/en/latest/messages.html#serialization

Something like CatalogItem.to_dict(item) should do the trick (where item is the specific instance).

@matthiasa4
Copy link

@busunkim96 that did the trick! Thanks a lot :)

@danoscarmike
Copy link

@software-dov any thoughts on this one?

@busunkim96
Copy link
Contributor

This is fixed in https://github.com/googleapis/gapic-generator-python/releases/tag/v0.43.0. It should be resolved when the library is re-genenerated.

@parthea
Copy link
Contributor

parthea commented Mar 27, 2021

I'm going to close this off as the root cause has been determined and the generator has been updated.

@parthea parthea closed this as completed Mar 27, 2021
busunkim96 pushed a commit that referenced this issue Mar 29, 2021
fix: BREAKING rename `PriceRange.min` to `PriceRange.min_`, `PriceRange.max` to `PriceRange.max_`

fix: fix bug with enums closes #14, #20

feat: add async clients

feat: add common resource helper methods
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: recommendationengine Issues related to the googleapis/python-recommendations-ai API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants