Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

fix: revert "feat: allow enum strings in json serialization and deserialization"#110

Merged
busunkim96 merged 2 commits intomasterfrom
revert-107-stringy
Aug 28, 2020
Merged

fix: revert "feat: allow enum strings in json serialization and deserialization"#110
busunkim96 merged 2 commits intomasterfrom
revert-107-stringy

Conversation

@busunkim96
Copy link
Copy Markdown
Contributor

Reverts #107

Generated unit tests on a few libraries fail with proto-plus==1.8.0

texttospeech

____________________________ ERROR collecting tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.py ____________________________
tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.py:34: in <module>
    from google.cloud.texttospeech_v1beta1.services.text_to_speech import (
google/cloud/texttospeech_v1beta1/__init__.py:18: in <module>
    from .services.text_to_speech import TextToSpeechClient
google/cloud/texttospeech_v1beta1/services/text_to_speech/__init__.py:18: in <module>
    from .client import TextToSpeechClient
google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py:33: in <module>
    from google.cloud.texttospeech_v1beta1.types import cloud_tts
google/cloud/texttospeech_v1beta1/types/__init__.py:18: in <module>
    from .cloud_tts import (
google/cloud/texttospeech_v1beta1/types/cloud_tts.py:93: in <module>
    class Voice(proto.Message):
.nox/unit-3-6/lib/python3.6/site-packages/proto/message.py:214: in __new__
    field=[i.descriptor for i in fields],
.nox/unit-3-6/lib/python3.6/site-packages/proto/message.py:214: in <listcomp>
    field=[i.descriptor for i in fields],
.nox/unit-3-6/lib/python3.6/site-packages/proto/fields.py:92: in descriptor
    type_name = self.enum._meta.full_name
E   AttributeError: 'str' object has no attribute '_meta'

Translate:

___________________________ ERROR collecting tests/unit/gapic/translate_v3beta1/test_translation_service.py ___________________________
tests/unit/gapic/translate_v3beta1/test_translation_service.py:38: in <module>
    from google.cloud.translate_v3beta1.services.translation_service import (
google/cloud/translate_v3beta1/__init__.py:18: in <module>
    from .services.translation_service import TranslationServiceClient
google/cloud/translate_v3beta1/services/translation_service/__init__.py:18: in <module>
    from .client import TranslationServiceClient
google/cloud/translate_v3beta1/services/translation_service/client.py:35: in <module>
    from google.cloud.translate_v3beta1.services.translation_service import pagers
google/cloud/translate_v3beta1/services/translation_service/pagers.py:20: in <module>
    from google.cloud.translate_v3beta1.types import translation_service
google/cloud/translate_v3beta1/types/__init__.py:18: in <module>
    from .translation_service import (
google/cloud/translate_v3beta1/types/translation_service.py:996: in <module>
    class DeleteGlossaryResponse(proto.Message):
.nox/unit-3-8/lib/python3.8/site-packages/proto/message.py:258: in __new__
    file_info.generate_file_pb(new_class=cls, fallback_salt=full_name)
.nox/unit-3-8/lib/python3.8/site-packages/proto/_file_info.py:102: in generate_file_pb
    pool.Add(self.descriptor)
E   TypeError: Couldn't build proto file into descriptor pool!
E   Invalid proto descriptor for file "google/cloud/translate_v3beta1/types/translation_service.proto":
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_BatchTranslateMetadata_State: "google.cloud.translation.v3beta1_BatchTranslateMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_BatchTranslateMetadata_State: "google.cloud.translation.v3beta1_BatchTranslateMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_BatchTranslateMetadata_State: "google.cloud.translation.v3beta1_BatchTranslateMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_CreateGlossaryMetadata_State: "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_CreateGlossaryMetadata_State: "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_CreateGlossaryMetadata_State: "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.STATE_UNSPECIFIED: "STATE_UNSPECIFIED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.STATE_UNSPECIFIED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "STATE_UNSPECIFIED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.RUNNING: "RUNNING" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.RUNNING: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "RUNNING" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.SUCCEEDED: "SUCCEEDED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.SUCCEEDED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "SUCCEEDED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.FAILED: "FAILED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.FAILED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "FAILED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.CANCELLING: "CANCELLING" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.CANCELLING: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "CANCELLING" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.CANCELLED: "CANCELLED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.CANCELLED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "CANCELLED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State: "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State: "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State: "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State" is not a valid identifier.
E     google.cloud.translation.v3beta1.STATE_UNSPECIFIED: "STATE_UNSPECIFIED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.STATE_UNSPECIFIED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "STATE_UNSPECIFIED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.RUNNING: "RUNNING" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.RUNNING: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "RUNNING" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.SUCCEEDED: "SUCCEEDED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.SUCCEEDED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "SUCCEEDED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.FAILED: "FAILED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.FAILED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "FAILED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.CANCELLING: "CANCELLING" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.CANCELLING: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "CANCELLING" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.CANCELLED: "CANCELLED" is already defined in "google.cloud.translation.v3beta1".
E     google.cloud.translation.v3beta1.CANCELLED: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "CANCELLED" must be unique within "google.cloud.translation.v3beta1", not just within "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State".
E     google.cloud.translation.v3beta1.BatchTranslateMetadata.state: "google.cloud.translation.v3beta1_BatchTranslateMetadata_State" is not defined.
E     google.cloud.translation.v3beta1.CreateGlossaryMetadata.state: "google.cloud.translation.v3beta1_CreateGlossaryMetadata_State" is not defined.
E     google.cloud.translation.v3beta1.DeleteGlossaryMetadata.state: "google.cloud.translation.v3beta1_DeleteGlossaryMetadata_State" is not defined.


@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 28, 2020
@busunkim96 busunkim96 changed the title Revert "feat: allow enum strings in json serialization and deserialization" fix: revert "feat: allow enum strings in json serialization and deserialization" Aug 28, 2020
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 28, 2020

Codecov Report

Merging #110 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #110   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines          838       811   -27     
  Branches       139       136    -3     
=========================================
- Hits           838       811   -27     
Impacted Files Coverage Δ
proto/enums.py 100.00% <ø> (ø)
proto/marshal/marshal.py 100.00% <ø> (ø)
proto/marshal/rules/dates.py 100.00% <ø> (ø)
proto/marshal/rules/enums.py 100.00% <ø> (ø)
proto/_file_info.py 100.00% <100.00%> (ø)
proto/fields.py 100.00% <100.00%> (ø)
proto/marshal/rules/struct.py 100.00% <100.00%> (ø)
proto/message.py 100.00% <100.00%> (ø)
proto/modules.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b12b19...380e683. Read the comment docs.

@busunkim96 busunkim96 merged commit bd3d50e into master Aug 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants