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
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"]
. TheCoreAccountCreate
mutation currently looks like this when creating an account with a particular roleWith correct enum support in the GraphQL API,
"read_only"
becomesREAD_ONLY
Additional Information
you can turn enum support in the GraphQL API on or off using the environment variable
INFRAHUB_EXPERIMENTAL_GRAPHQL_ENUMS=true/false