diff --git a/graphql/admin/admin.go b/graphql/admin/admin.go index f15ae32fea7..e5e823debd4 100644 --- a/graphql/admin/admin.go +++ b/graphql/admin/admin.go @@ -46,6 +46,22 @@ const ( // GraphQL schema for /admin endpoint. graphqlAdminSchema = ` + """ + The Int64 scalar type represents a signed 64‐bit numeric non‐fractional value. + Int64 can represent values in range [-(2^63),(2^63 - 1)]. + """ + scalar Int64 + + """ + The UInt64 scalar type represents a unsigned 64‐bit numeric non‐fractional value. + UInt64 can represent values in range [0,(2^64 - 1)]. + """ + scalar UInt64 + + """ + The DateTime scalar type represents date and time as a string in RFC3339 format. + For example: "1985-04-12T23:20:50.52Z" represents 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. + """ scalar DateTime """ @@ -100,12 +116,12 @@ const ( """ Time in nanoseconds since the node started. """ - uptime: Int + uptime: Int64 """ Time in Unix epoch time that the node was last contacted by another Zero or Alpha node. """ - lastEcho: Int + lastEcho: Int64 """ List of ongoing operations in the background. @@ -124,51 +140,51 @@ const ( } type MembershipState { - counter: Int + counter: UInt64 groups: [ClusterGroup] zeros: [Member] - maxUID: Int - maxNsID: Int - maxTxnTs: Int - maxRaftId: Int + maxUID: UInt64 + maxNsID: UInt64 + maxTxnTs: UInt64 + maxRaftId: UInt64 removed: [Member] cid: String license: License } type ClusterGroup { - id: Int + id: UInt64 members: [Member] tablets: [Tablet] - snapshotTs: Int - checksum: Int + snapshotTs: UInt64 + checksum: UInt64 } type Member { - id: Int - groupId: Int + id: UInt64 + groupId: UInt64 addr: String leader: Boolean amDead: Boolean - lastUpdate: Int + lastUpdate: UInt64 clusterInfoOnly: Boolean forceGroupId: Boolean } type Tablet { - groupId: Int + groupId: UInt64 predicate: String force: Boolean space: Int remove: Boolean readOnly: Boolean - moveTs: Int + moveTs: UInt64 } type License { user: String - maxNodes: Int - expiryTs: Int + maxNodes: UInt64 + expiryTs: Int64 enabled: Boolean } diff --git a/graphql/admin/endpoints_ee.go b/graphql/admin/endpoints_ee.go index 51dbd5acee4..a557e099a68 100644 --- a/graphql/admin/endpoints_ee.go +++ b/graphql/admin/endpoints_ee.go @@ -172,7 +172,7 @@ const adminTypes = ` """ The ID of the cluster group. """ - groupId: Int + groupId: UInt64 """ List of predicates assigned to the group. @@ -189,7 +189,7 @@ const adminTypes = ` """ Number of this backup within the backup series. The full backup always has a value of one. """ - backupNum: Int + backupNum: UInt64 """ Whether this backup was encrypted. @@ -210,7 +210,7 @@ const adminTypes = ` The timestamp at which this backup was taken. The next incremental backup will start from this timestamp. """ - since: Int + since: UInt64 """ The type of backup, either full or incremental. @@ -417,7 +417,7 @@ const adminTypes = ` } type NamespacePayload { - namespaceId: Int + namespaceId: UInt64 message: String } @@ -430,7 +430,7 @@ const adminTypes = ` type ResetPasswordPayload { userId: String message: String - namespace: Int + namespace: UInt64 } ` diff --git a/graphql/e2e/common/admin.go b/graphql/e2e/common/admin.go index 112a27f383d..aecea631f63 100644 --- a/graphql/e2e/common/admin.go +++ b/graphql/e2e/common/admin.go @@ -434,6 +434,7 @@ func adminState(t *testing.T) { user expiryTs enabled + maxNodes } } }`, @@ -460,6 +461,7 @@ func adminState(t *testing.T) { User string ExpiryTs int64 Enabled bool + MaxNodes uint64 } } } @@ -512,5 +514,6 @@ func adminState(t *testing.T) { require.Equal(t, state.Cid, result.State.Cid) require.Equal(t, state.License.User, result.State.License.User) require.Equal(t, state.License.ExpiryTs, result.State.License.ExpiryTs) + require.Equal(t, state.License.MaxNodes, result.State.License.MaxNodes) require.Equal(t, state.License.Enabled, result.State.License.Enabled) } diff --git a/graphql/schema/completion.go b/graphql/schema/completion.go index 25a3f765196..d5b323fc24c 100644 --- a/graphql/schema/completion.go +++ b/graphql/schema/completion.go @@ -429,6 +429,17 @@ func coerceScalar(val interface{}, field Field, path []interface{}) (interface{} default: return nil, valueCoercionError(v) } + // UInt64 is present only in admin schema. + case "UInt64": + switch v := val.(type) { + case json.Number: + if _, err := strconv.ParseUint(v.String(), 10, 64); err != nil { + return nil, valueCoercionError(v) + } + // do nothing, as val is already a valid number in UInt64 range + default: + return nil, valueCoercionError(v) + } case "Float": switch v := val.(type) { case bool: