-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
type/featureNew feature or requestNew feature or request
Description
Component
Python SDK
Describe the Feature Request
Follows opsmill/infrahub#918
The GraphQL API can now support enums based on our schema correctly. The Python SDK will need some changes to how it generates mutations for an attribute using an enum behind the scenes.
Describe the Use Case
For an example, let's use the CoreAccount.role attribute, which uses this enum ["admin", "read-only", "read-write"].
The CoreAccountCreate mutation currently looks like this when creating an account with a particular role
mutation CreateAccount {
CoreAccountCreate(
data:{
name: {value: "userperson"},
password: {value: "infrahub"},
role: {value: "read-only"}
}
) {
ok
object {
role { value }
}
}
}
With correct enum support in the GraphQL API, "read_only" becomes READ_ONLY
mutation CreateAccount {
CoreAccountCreate(
data:{
name: {value: "userperson"},
password: {value: "infrahub"},
role: {value: READ_ONLY}
}
) {
ok
object {
role { value }
}
}
}
Additional Information
you can turn enum support in the GraphQL API on or off using the environment variable INFRAHUB_EXPERIMENTAL_GRAPHQL_ENUMS=true/false
Metadata
Metadata
Assignees
Labels
type/featureNew feature or requestNew feature or request