Skip to content

Python SDK: enum support on codegen  #4445

Closed

Description

@grouville

Context

When implementing #4437 , in order to have autocompletion, I relied on the GraphQL enum type:

enum CacheSharingMode {
  SHARED
  PRIVATE
  LOCKED
}

Everything works on raw GraphQL queries, but whenever I tried generating the SDK code, it failed for all of them. The enum codegen implementation for NodeSDK has been added by @dolanor, directly on #4437 . @dolanor is waiting for @TomChv's refactor to be merged to implement the Go fix

Problem

It seems that codegen doesn't work for GraphQL enum type on Python SDK either.

The error output, on Python SDK codegen is:

Poe => python -m dagger generate --output ./src/dagger/api/gen.py
Client generated successfully to src/dagger/api/gen.py 🚀
Poe => python -m dagger generate --output ./src/dagger/api/gen_sync.py --sync
Error: Sequence aborted after failed subtask 'python -m dagger generate --output ${GEN_PATH}/gen_sync.py --sync'
Stderr:
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/sdk/python/src/dagger/__init__.py", line 1, in <module>
    from .api.gen import *
  File "/sdk/python/src/dagger/api/gen.py", line 66, in <module>
    class Container(Type):
  File "/sdk/python/src/dagger/api/gen.py", line 552, in Container
    def with_mounted_cache(self, path: str, cache: CacheVolume, source: Optional["Directory"] = None, sharing: Optional[CacheSharingMode] = None,) -> "Container":
                                                                                                                        ^^^^^^^^^^^^^^^^
NameError: name 'CacheSharingMode' is not defined

Please visit https://dagger.io/help#go for troubleshooting guidance.
exit status 1

cc @helderco

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

Metadata

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