Skip to content

Generated unsupport type bool in enum class #847

Closed

Description

Hi @iscai-msft
Track2 codegen generated an unsupport type: bug

class Enum37(with_metaclass(_CaseInsensitiveEnumMeta, bool, Enum)):

    FALSE = False
    TRUE = True

I don't find this error in track1, so I think track2 codegen uses different logic here.

Another solution is that I add a directive in python.md to change the type in schema. Like this

I want to know should it be fixed in codegen ?

Import error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/vsts/work/1/s/sdk/security/azure-mgmt-security/.tox/depends/lib/python3.5/site-packages/azure/mgmt/security/__init__.py", line 9, in <module>
    from ._security_center import SecurityCenter
  File "/home/vsts/work/1/s/sdk/security/azure-mgmt-security/.tox/depends/lib/python3.5/site-packages/azure/mgmt/security/_security_center.py", line 21, in <module>
    from .operations import ComplianceResultsOperations
  File "/home/vsts/work/1/s/sdk/security/azure-mgmt-security/.tox/depends/lib/python3.5/site-packages/azure/mgmt/security/operations/__init__.py", line 9, in <module>
    from ._compliance_results_operations import ComplianceResultsOperations
  File "/home/vsts/work/1/s/sdk/security/azure-mgmt-security/.tox/depends/lib/python3.5/site-packages/azure/mgmt/security/operations/_compliance_results_operations.py", line 17, in <module>
    from .. import models
  File "/home/vsts/work/1/s/sdk/security/azure-mgmt-security/.tox/depends/lib/python3.5/site-packages/azure/mgmt/security/models/__init__.py", line 478, in <module>
    from ._security_center_enums import (
  File "/home/vsts/work/1/s/sdk/security/azure-mgmt-security/.tox/depends/lib/python3.5/site-packages/azure/mgmt/security/models/_security_center_enums.py", line 258, in <module>
    class Enum37(with_metaclass(_CaseInsensitiveEnumMeta, bool, Enum)):
  File "/home/vsts/work/1/s/sdk/security/azure-mgmt-security/.tox/depends/lib/python3.5/site-packages/six.py", line 856, in __new__
    return meta(name, resolved_bases, d)
  File "/opt/hostedtoolcache/Python/3.5.10/x64/lib/python3.5/enum.py", line 114, in __new__
    enum_class = super().__new__(metacls, cls, bases, classdict)
TypeError: type 'bool' is not an acceptable base typ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions