Skip to content

Commit aabc518

Browse files
mattshardmanhasura-bot
authored andcommitted
console: fix remote schema permissions default args
PR-URL: hasura/graphql-engine-mono#3067 GitOrigin-RevId: cff7555b8ff0d99f1f21148281147bc6f97adaf2
1 parent 63cff8b commit aabc518

6 files changed

Lines changed: 1355 additions & 50 deletions

File tree

‎console/src/components/Services/RemoteSchema/Permissions/__tests__/__snapshots__/utils.test.ts.snap‎

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exports[`Utils.ts generateSDL 1`] = `
66
}
77
88
type query_root{
9-
users(distinct_on : [users_select_column!] limit : Int offset : Int order_by : [users_order_by!] where : users_bool_exp ): [users!]!
9+
users(distinct_on : [users_select_column!] limit : Int offset : Int order_by : [users_order_by!] where : users_bool_exp ): [users!]!
1010
}
1111
1212
type books{
@@ -237,7 +237,7 @@ exports[`Utils.ts generateSDL 2`] = `
237237
}
238238
239239
type query_root{
240-
users(distinct_on : [users_select_column!] limit : Int offset : Int order_by : [users_order_by!] where : users_bool_exp ): [users!]!
240+
users(distinct_on : [users_select_column!] limit : Int offset : Int order_by : [users_order_by!] where : users_bool_exp ): [users!]!
241241
}
242242
243243
type books{
@@ -468,7 +468,7 @@ exports[`Utils.ts generateSDL 3`] = `
468468
}
469469
470470
type Query{
471-
continents(filter : ContinentFilterInput ): [Continent!]!
471+
continents(filter : ContinentFilterInput = { code: { eq:\\"AF\\"}} ): [Continent!]!
472472
}
473473
474474
type Continent{
@@ -525,7 +525,7 @@ exports[`Utils.ts generateSDL 4`] = `
525525
}
526526
527527
type Query{
528-
continents(filter : ContinentFilterInput ): [Continent!]!
528+
continents(filter : ContinentFilterInput = { code: { eq:\\"AF\\"}} ): [Continent!]!
529529
}
530530
531531
type Continent{
@@ -800,6 +800,32 @@ enum users_select_column{
800800
"
801801
`;
802802

803+
exports[`Utils.ts generateSDL with default values 1`] = `
804+
"schema{
805+
query: Query
806+
}
807+
808+
type Query{
809+
workout(where : ID! stage : Stage! = DRAFT locales : Locale! = en ): WorkoutType!
810+
}
811+
812+
type WorkoutType{
813+
id : ID!
814+
name : String
815+
description : String
816+
}
817+
818+
enum Stage{
819+
DRAFT
820+
PUBLISHED
821+
}
822+
823+
enum Locale{
824+
en
825+
}
826+
"
827+
`;
828+
803829
exports[`Utils.ts getRemoteSchemaFields 1`] = `
804830
Array [
805831
Object {
@@ -4634,7 +4660,11 @@ Array [
46344660
"args": Object {
46354661
"filter": Object {
46364662
"astNode": undefined,
4637-
"defaultValue": undefined,
4663+
"defaultValue": Object {
4664+
"code": Object {
4665+
"eq": "AF",
4666+
},
4667+
},
46384668
"description": "",
46394669
"extensions": undefined,
46404670
"name": "filter",
@@ -5861,7 +5891,11 @@ Array [
58615891
"args": Object {
58625892
"filter": Object {
58635893
"astNode": undefined,
5864-
"defaultValue": undefined,
5894+
"defaultValue": Object {
5895+
"code": Object {
5896+
"eq": "AF",
5897+
},
5898+
},
58655899
"description": "",
58665900
"extensions": undefined,
58675901
"name": "filter",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"userPreset": "schema { query: query_root }\ntype query_root { users(distinct_on: [users_select_column!] , limit: Int , offset: Int , order_by: [users_order_by!] , where: users_bool_exp @preset(value: {id: {_eq: \"X-Hasura-User-Id\"}})): [users!]! }\nenum order_by {asc asc_nulls_first asc_nulls_last desc desc_nulls_first desc_nulls_last }\ninput users_order_by {books_aggregate: books_aggregate_order_by id: order_by name: order_by }\ninput books_aggregate_order_by {avg: books_avg_order_by count: order_by max: books_max_order_by min: books_min_order_by stddev: books_stddev_order_by stddev_pop: books_stddev_pop_order_by stddev_samp: books_stddev_samp_order_by sum: books_sum_order_by var_pop: books_var_pop_order_by var_samp: books_var_samp_order_by variance: books_variance_order_by }\ninput books_avg_order_by {author: order_by id: order_by }\ninput books_max_order_by {author: order_by book_name: order_by id: order_by }\ninput books_min_order_by {author: order_by book_name: order_by id: order_by }\ninput books_stddev_order_by {author: order_by id: order_by }\ninput books_stddev_pop_order_by {author: order_by id: order_by }\ninput books_stddev_samp_order_by {author: order_by id: order_by }\ninput books_sum_order_by {author: order_by id: order_by }\ninput books_var_pop_order_by {author: order_by id: order_by }\ninput books_var_samp_order_by {author: order_by id: order_by }\ninput books_variance_order_by {author: order_by id: order_by }\ninput books_bool_exp {_and: [books_bool_exp] _not: books_bool_exp _or: [books_bool_exp] author: Int_comparison_exp book_name: String_comparison_exp id: Int_comparison_exp user: users_bool_exp }\ninput Int_comparison_exp {_eq: Int _gt: Int _gte: Int _in: [Int!] _is_null: Boolean _lt: Int _lte: Int _neq: Int _nin: [Int!] }\ninput String_comparison_exp {_eq: String _gt: String _gte: String _ilike: String _in: [String!] _is_null: Boolean _like: String _lt: String _lte: String _neq: String _nilike: String _nin: [String!] _nlike: String _nsimilar: String _similar: String }\ninput users_bool_exp {_and: [users_bool_exp] _not: users_bool_exp _or: [users_bool_exp] books: books_bool_exp id: Int_comparison_exp name: String_comparison_exp }\ntype books { author: Int! book_name: String! id: Int! user: users! }\ntype users { books: [books!]! books_aggregate: books_aggregate! id: Int! name: String! }\ntype books_aggregate { aggregate: books_aggregate_fields nodes: [books!]! }\ntype books_aggregate_fields { avg: books_avg_fields count: Int max: books_max_fields min: books_min_fields stddev: books_stddev_fields stddev_pop: books_stddev_pop_fields stddev_samp: books_stddev_samp_fields sum: books_sum_fields var_pop: books_var_pop_fields var_samp: books_var_samp_fields variance: books_variance_fields }\ntype books_avg_fields { author: Float id: Float }\ntype books_max_fields { author: Int book_name: String id: Int }\ntype books_min_fields { author: Int book_name: String id: Int }\ntype books_stddev_fields { author: Float id: Float }\ntype books_stddev_pop_fields { author: Float id: Float }\ntype books_stddev_samp_fields { author: Float id: Float }\ntype books_sum_fields { author: Int id: Int }\ntype books_var_pop_fields { author: Float id: Float }\ntype books_var_samp_fields { author: Float id: Float }\ntype books_variance_fields { author: Float id: Float }\nenum users_select_column {id name }",
3-
"continentsPreset": "schema { query: Query }\ntype Query { continents(filter: ContinentFilterInput @preset(value: {code: {eq: \"AF\"}})): [Continent!]! }\ninput ContinentFilterInput {code: StringQueryOperatorInput }\ninput StringQueryOperatorInput {eq: String ne: String in: [String] nin: [String] regex: String glob: String }\ntype Continent { code: ID! name: String! countries: [Country!]! }\ntype Country { code: ID! name: String! native: String! phone: String! continent: Continent! capital: String currency: String languages: [Language!]! emoji: String! emojiU: String! states: [State!]! }\ntype Language { code: ID! name: String native: String rtl: Boolean! }\ntype State { code: String name: String! country: Country! }"
3+
"continentsPreset": "schema { query: Query }\ntype Query { continents(filter: ContinentFilterInput = {code: {eq: \"AF\"}} @preset(value: {code: {eq: \"AF\"}})): [Continent!]! }\ninput ContinentFilterInput {code: StringQueryOperatorInput }\ninput StringQueryOperatorInput {eq: String ne: String in: [String] nin: [String] regex: String glob: String }\ntype Continent { code: ID! name: String! countries: [Country!]! }\ntype Country { code: ID! name: String! native: String! phone: String! continent: Continent! capital: String currency: String languages: [Language!]! emoji: String! emojiU: String! states: [State!]! }\ntype Language { code: ID! name: String native: String rtl: Boolean! }\ntype State { code: String name: String! country: Country! }",
4+
"workoutPreset": "schema { query: Query } type Query { workout(where: ID!, stage: Stage! = DRAFT, locales: Locale! = en): WorkoutType! } type WorkoutType { description: String id: ID! name: String } enum Locale { en } enum Stage {DRAFT PUBLISHED }"
45
}

‎console/src/components/Services/RemoteSchema/Permissions/__tests__/fixtures/schema2.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"name": "ContinentFilterInput",
2222
"ofType": null
2323
},
24-
"defaultValue": null
24+
"defaultValue": "{code: {eq: \"AF\"}}"
2525
}
2626
],
2727
"type": {

0 commit comments

Comments
 (0)