Skip to content

Commit b95685b

Browse files
cleanup graphql schema conversion
1 parent 8f8c5ba commit b95685b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

graphql/convertSchema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func LowerFirstLetter(s string) string {
5656

5757
func generateQueryList(classes []string) {
5858
for i, v := range classes {
59-
classes[i] = LowerFirstLetter(classes[i]) + "(offset: Int first: Int filter: JSON sort: JSON accessibility: Accessibility = all format: Format = json): [" + v + "Type!]!"
59+
classes[i] = LowerFirstLetter(classes[i]) + "(offset: Int first: Int filter: JSON sort: [SortInput] accessibility: Accessibility = all): [" + v + "Type!]!"
6060
}
6161
}
6262

graphql/griptographql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func GripGraphqltoGraphql(graph *gripql.Graph) string {
2323
// Write gen3 style boiler plate to mirror thier args
2424
schemaBuilder.WriteString("scalar JSON\n")
2525
schemaBuilder.WriteString("enum Accessibility {\n all\n accessible\n unaccessible\n}\n")
26-
schemaBuilder.WriteString("enum Format {\n json\n tsv\n csv\n}\n")
26+
schemaBuilder.WriteString("input SortInput {\n field: String!\n descending: Boolean\n}\n")
2727

2828
for _, v := range graph.Vertices {
2929
//fmt.Println("V: ", v)
@@ -53,7 +53,7 @@ func GripGraphqltoGraphql(graph *gripql.Graph) string {
5353
for field, fieldType := range v.Data.AsMap() {
5454
strFieldType, ok := fieldType.(string)
5555
if ok && (strings.HasSuffix(strFieldType, "Type") || strings.HasSuffix(strFieldType, "Union")) {
56-
schemaBuilder.WriteString(fmt.Sprintf(" %s(offset: Int first: Int filter: JSON sort: JSON accessibility: Accessibility = all format: Format = json): %s!\n", field, strFieldType))
56+
schemaBuilder.WriteString(fmt.Sprintf(" %s(offset: Int first: Int): %s!\n", field, strFieldType))
5757
} else {
5858
schemaBuilder.WriteString(fmt.Sprintf(" %s: %s\n", field, fieldType))
5959
}

0 commit comments

Comments
 (0)