Join us from October 8-10 in New York City to learn the latest tips, trends, and news about GraphQL Federation and API platform engineering.Join us for GraphQL Summit 2024 in NYC
Docs
Start for Free
You're viewing documentation for a previous version of this software. Switch to the latest stable version.


ENUM

GraphQLEnum

public enum GraphQLEnum<T>: CaseIterable, Equatable, RawRepresentable
where T: RawRepresentable & CaseIterable, T.RawValue == String

A generic enum that wraps a generated enum from a .

GraphQLEnum provides an __unknown case that is used when the response returns a value that is not recognized as a valid enum case. This is usually caused by future cases added to the enum on the schema after code generation.

Cases

case(_:)

case `case`(T)

A recognized case of the wrapped enum.

__unknown(_:)

case __unknown(String)

An unrecognized value for the enum. The associated value exposes the raw String data from the response.

Properties

value

public var value: T?

The underlying enum case. If the value is __unknown, this will be nil.

rawValue

public var rawValue: String

allCases

public static var allCases: [GraphQLEnum<T>]

A collection of all known values of the wrapped enum. This collection does not include the __unknown case.

Methods

init(_:)

public init(_ caseValue: T)

init(rawValue:)

public init(rawValue: String)

Parameters

NameDescription
rawValueThe raw value to use for the new instance.
Next
Introduction
Rate articleRateEdit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc., d/b/a Apollo GraphQL.

Privacy Policy

Company