Skip to content

Commit

Permalink
Add support for aliases in queries
Browse files Browse the repository at this point in the history
  • Loading branch information
mbossenbroek committed Apr 19, 2024
1 parent 95f27dc commit e1ca748
Show file tree
Hide file tree
Showing 49 changed files with 275 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.cl

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.types.PersonFilter
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(filter: PersonFilter? = default<QueryProjection, PersonFilter?>("filter"),
_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection, "filter" to filter)
public fun people(
_alias: String? = null,
filter: PersonFilter? = default<QueryProjection, PersonFilter?>("filter"),
_projection: PersonProjection.() -> PersonProjection,
): QueryProjection {
field(_alias, "people", PersonProjection(), _projection, "filter" to filter)
return this
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.ex

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.expected.types.PersonFilter
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(filter: PersonFilter? = default<QueryProjection, PersonFilter?>("filter"),
_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection, "filter" to filter)
public fun people(
_alias: String? = null,
filter: PersonFilter? = default<QueryProjection, PersonFilter?>("filter"),
_projection: PersonProjection.() -> PersonProjection,
): QueryProjection {
field(_alias, "people", PersonProjection(), _projection, "filter" to filter)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInterface.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection)
public fun people(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "people", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection)
public fun people(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "people", PersonProjection(), _projection)
return this
}

public fun friends(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("friends", PersonProjection(), _projection)
public fun friends(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "friends", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection)
public fun people(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "people", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.types.MovieFilter
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun search(movieFilter: MovieFilter, _projection: MovieProjection.() -> MovieProjection):
QueryProjection {
field("search", MovieProjection(), _projection, "movieFilter" to movieFilter)
public fun search(
_alias: String? = null,
movieFilter: MovieFilter,
_projection: MovieProjection.() -> MovieProjection,
): QueryProjection {
field(_alias, "search", MovieProjection(), _projection, "movieFilter" to movieFilter)
return this
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.types.MovieFilter
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun search(movieFilter: MovieFilter, _projection: MovieProjection.() -> MovieProjection):
QueryProjection {
field("search", MovieProjection(), _projection, "movieFilter" to movieFilter)
public fun search(
_alias: String? = null,
movieFilter: MovieFilter,
_projection: MovieProjection.() -> MovieProjection,
): QueryProjection {
field(_alias, "search", MovieProjection(), _projection, "movieFilter" to movieFilter)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWIthNoFields.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun me(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("me", PersonProjection(), _projection)
public fun me(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "me", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun test(_projection: RequiredTestTypeProjection.() -> RequiredTestTypeProjection):
QueryProjection {
field("test", RequiredTestTypeProjection(), _projection)
public fun test(_alias: String? = null,
_projection: RequiredTestTypeProjection.() -> RequiredTestTypeProjection): QueryProjection {
field(_alias, "test", RequiredTestTypeProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class EntityConnectionProjection : GraphQLProjection() {
public fun pageInfo(_projection: PageInfoProjection.() -> PageInfoProjection):
EntityConnectionProjection {
field("pageInfo", PageInfoProjection(), _projection)
public fun pageInfo(_alias: String? = null,
_projection: PageInfoProjection.() -> PageInfoProjection): EntityConnectionProjection {
field(_alias, "pageInfo", PageInfoProjection(), _projection)
return this
}

public fun edges(_projection: EntityEdgeProjection.() -> EntityEdgeProjection):
EntityConnectionProjection {
field("edges", EntityEdgeProjection(), _projection)
public fun edges(_alias: String? = null,
_projection: EntityEdgeProjection.() -> EntityEdgeProjection): EntityConnectionProjection {
field(_alias, "edges", EntityEdgeProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class EntityEdgeProjection : GraphQLProjection() {
public val cursor: EntityEdgeProjection
Expand All @@ -9,8 +10,9 @@ public class EntityEdgeProjection : GraphQLProjection() {
return this
}

public fun node(_projection: EntityProjection.() -> EntityProjection): EntityEdgeProjection {
field("node", EntityProjection(), _projection)
public fun node(_alias: String? = null, _projection: EntityProjection.() -> EntityProjection):
EntityEdgeProjection {
field(_alias, "node", EntityProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun entity(_projection: EntityProjection.() -> EntityProjection): QueryProjection {
field("entity", EntityProjection(), _projection)
public fun entity(_alias: String? = null, _projection: EntityProjection.() -> EntityProjection):
QueryProjection {
field(_alias, "entity", EntityProjection(), _projection)
return this
}

public
fun entityConnection(_projection: EntityConnectionProjection.() -> EntityConnectionProjection):
QueryProjection {
field("entityConnection", EntityConnectionProjection(), _projection)
public fun entityConnection(_alias: String? = null,
_projection: EntityConnectionProjection.() -> EntityConnectionProjection): QueryProjection {
field(_alias, "entityConnection", EntityConnectionProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class CarProjection : GraphQLProjection() {
public val make: CarProjection
Expand All @@ -15,8 +16,9 @@ public class CarProjection : GraphQLProjection() {
return this
}

public fun engine(_projection: EngineProjection.() -> EngineProjection): CarProjection {
field("engine", EngineProjection(), _projection)
public fun engine(_alias: String? = null, _projection: EngineProjection.() -> EngineProjection):
CarProjection {
field(_alias, "engine", EngineProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class EngineProjection : GraphQLProjection() {
public val type: EngineProjection
Expand All @@ -21,9 +22,9 @@ public class EngineProjection : GraphQLProjection() {
return this
}

public fun performance(_projection: PerformanceProjection.() -> PerformanceProjection):
EngineProjection {
field("performance", PerformanceProjection(), _projection)
public fun performance(_alias: String? = null,
_projection: PerformanceProjection.() -> PerformanceProjection): EngineProjection {
field(_alias, "performance", PerformanceProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun cars(_projection: CarProjection.() -> CarProjection): QueryProjection {
field("cars", CarProjection(), _projection)
public fun cars(_alias: String? = null, _projection: CarProjection.() -> CarProjection):
QueryProjection {
field(_alias, "cars", CarProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterface.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection)
public fun people(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "people", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection)
public fun people(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "people", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection)
public fun people(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "people", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection {
field("people", PersonProjection(), _projection)
public fun people(_alias: String? = null, _projection: PersonProjection.() -> PersonProjection):
QueryProjection {
field(_alias, "people", PersonProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class QueryProjection : GraphQLProjection() {
public fun products(_projection: ProductProjection.() -> ProductProjection): QueryProjection {
field("products", ProductProjection(), _projection)
public fun products(_alias: String? = null,
_projection: ProductProjection.() -> ProductProjection): QueryProjection {
field(_alias, "products", ProductProjection(), _projection)
return this
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected.client

import com.netflix.graphql.dgs.codegen.GraphQLProjection
import kotlin.String

public class EntityConnectionProjection : GraphQLProjection() {
public fun pageInfo(_projection: PageInfoProjection.() -> PageInfoProjection):
EntityConnectionProjection {
field("pageInfo", PageInfoProjection(), _projection)
public fun pageInfo(_alias: String? = null,
_projection: PageInfoProjection.() -> PageInfoProjection): EntityConnectionProjection {
field(_alias, "pageInfo", PageInfoProjection(), _projection)
return this
}

public fun edges(_projection: EntityEdgeProjection.() -> EntityEdgeProjection):
EntityConnectionProjection {
field("edges", EntityEdgeProjection(), _projection)
public fun edges(_alias: String? = null,
_projection: EntityEdgeProjection.() -> EntityEdgeProjection): EntityConnectionProjection {
field(_alias, "edges", EntityEdgeProjection(), _projection)
return this
}
}
Loading

0 comments on commit e1ca748

Please sign in to comment.