Skip to content

Commit

Permalink
fix(interface): fix interface json type name
Browse files Browse the repository at this point in the history
  • Loading branch information
calebmer committed Oct 14, 2016
1 parent 3a58adf commit a330f3c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/kitchen-sink/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ create function b.mult_3(int, int) returns int as $$ select $1 * $2 $$ language
create function b.mult_4(int, int) returns int as $$ select $1 * $2 $$ language sql strict;

create function c.json_identity(json json) returns json as $$ select json $$ language sql immutable;
create function c.json_identity_mutation(json json) returns json as $$ select json $$ language sql;
create function c.types_query(a bigint, b boolean, c varchar, d integer[], e json, f numrange) returns boolean as $$ select false $$ language sql stable strict;
create function c.types_mutation(a bigint, b boolean, c varchar, d integer[], e json, f numrange) returns boolean as $$ select false $$ language sql strict;
create function b.compound_type_query(object c.compound_type) returns c.compound_type as $$ select (object.a + 1, object.b, object.c, object.d, object.foo_bar)::c.compound_type $$ language sql stable;
Expand Down
2 changes: 1 addition & 1 deletion src/interface/type/primitive/jsonType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import NamedType from '../NamedType'
* be defined as an array of characters.
*/
const jsonType: NamedType<string> = {
name: 'string',
name: 'json',
description:
'A JavaScript object encoded in the JSON format as specified by ' +
'[ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,9 @@ Object {
6,
],
},
"jsonIdentityMutation": Object {
"json": "{\"a\":1,\"b\":2,\"c\":3}",
},
"mult1": Object {
"integer": 0,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,35 @@ enum IntSetQueryOrderBy {
# A JavaScript object encoded in the JSON format as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
scalar Json

# All input for the \`jsonIdentityMutation\` mutation.
input JsonIdentityMutationInput {
# An arbitrary string value with no semantic meaning. Will be included in the
# payload verbatim. May be used to track mutations by the client.
clientMutationId: String
json: Json
}

# The output of our \`jsonIdentityMutation\` mutation.
type JsonIdentityMutationPayload {
# The exact same \`clientMutationId\` that was provided in the mutation input,
# unchanged and unused. May be used by a client to track mutations.
clientMutationId: String
json: Json

# Our root query field type. Allows us to run any query from our mutation payload.
query: Query
}

# The root mutation type which contains root level fields which mutate data.
type Mutation {
intSetMutation(
# The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
input: IntSetMutationInput!
): IntSetMutationPayload
jsonIdentityMutation(
# The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
input: JsonIdentityMutationInput!
): JsonIdentityMutationPayload
noArgsMutation(
# The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
input: NoArgsMutationInput!
Expand Down Expand Up @@ -2964,6 +2987,25 @@ enum IntSetQueryOrderBy {
# A JavaScript object encoded in the JSON format as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
scalar Json

# All input for the \`jsonIdentityMutation\` mutation.
input JsonIdentityMutationInput {
# An arbitrary string value with no semantic meaning. Will be included in the
# payload verbatim. May be used to track mutations by the client.
clientMutationId: String
json: Json
}

# The output of our \`jsonIdentityMutation\` mutation.
type JsonIdentityMutationPayload {
# The exact same \`clientMutationId\` that was provided in the mutation input,
# unchanged and unused. May be used by a client to track mutations.
clientMutationId: String
json: Json

# Our root query field type. Allows us to run any query from our mutation payload.
query: Query
}

type JwtToken {
role: String
exp: Int
Expand Down Expand Up @@ -3109,6 +3151,10 @@ type Mutation {
# The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
input: IntSetMutationInput!
): IntSetMutationPayload
jsonIdentityMutation(
# The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
input: JsonIdentityMutationInput!
): JsonIdentityMutationPayload
noArgsMutation(
# The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
input: NoArgsMutationInput!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mutation {
jsonIdentityMutation(input: { json: "{\"a\":1,\"b\":2,\"c\":3}" }) { json }
add1Mutation(input: { arg0: 1, arg1: 2 }) { clientMutationId integer }
add2Mutation(input: { clientMutationId: "hello", a: 2, b: 2 }) { clientMutationId integer }
add3Mutation(input: { clientMutationId: "world", arg1: 5 }) { clientMutationId integer }
Expand Down
2 changes: 1 addition & 1 deletion src/postgraphql/__tests__/postgraphql-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test('will use a connected client from the pool, the schemas, and options to cre
pgPool.connect.mockReturnValue(Promise.resolve(pgClient))
await postgraphql(pgPool, schemas, options)
expect(pgPool.connect.mock.calls).toEqual([[]])
expect(createPostGraphQLSchema.mock.calls).toEqual([[pgClient, schemas, options]])
expect(createPostGraphQLSchema.mock.calls).toEqual([[pgClient, [schemas], options]])
expect(pgClient.release.mock.calls).toEqual([[]])
})

Expand Down

0 comments on commit a330f3c

Please sign in to comment.