Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
*
* Copyright 2020 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.netflix.graphql.dgs.codegen.java.fixtures;

public interface Node {
String getId();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected;

import java.lang.String;

public class DgsConstants {
public static final String QUERY_TYPE = "Query";

public static class QUERY {
public static final String TYPE_NAME = "Query";

public static final String People = "people";

public static class PEOPLE_INPUT_ARGUMENT {
public static final String Filter = "filter";
}
}

public static class PERSON {
public static final String TYPE_NAME = "Person";

public static final String Firstname = "firstname";

public static final String Lastname = "lastname";
}

public static class PERSONFILTER {
public static final String TYPE_NAME = "PersonFilter";

public static final String Email = "email";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected.client;

import com.netflix.graphql.dgs.client.codegen.GraphQLQuery;
import com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected.types.PersonFilter;
import graphql.language.VariableDefinition;
import java.lang.Override;
import java.lang.String;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class PeopleGraphQLQuery extends GraphQLQuery {
public PeopleGraphQLQuery(PersonFilter filter, String queryName, Set<String> fieldsSet) {
super("query", queryName);
if (filter != null || fieldsSet.contains("filter")) {
getInput().put("filter", filter);
}
}

public PeopleGraphQLQuery(PersonFilter filter, String queryName, Set<String> fieldsSet,
Map<String, String> variableReferences, List<VariableDefinition> variableDefinitions) {
super("query", queryName);
if (filter != null || fieldsSet.contains("filter")) {
getInput().put("filter", filter);
}
if(variableDefinitions != null) {
getVariableDefinitions().addAll(variableDefinitions);
}

if(variableReferences != null) {
getVariableReferences().putAll(variableReferences);
}
}

public PeopleGraphQLQuery() {
super("query");
}

@Override
public String getOperationName() {
return "people";
}

public static Builder newRequest() {
return new Builder();
}

public static class Builder {
private Set<String> fieldsSet = new HashSet<>();

private final Map<String, String> variableReferences = new HashMap<>();

private final List<VariableDefinition> variableDefinitions = new ArrayList<>();

private PersonFilter filter;

private String queryName;

public PeopleGraphQLQuery build() {
return new PeopleGraphQLQuery(filter, queryName, fieldsSet, variableReferences, variableDefinitions);

}

public Builder filter(PersonFilter filter) {
this.filter = filter;
this.fieldsSet.add("filter");
return this;
}

public Builder filterReference(String variableRef) {
this.variableReferences.put("filter", variableRef);
this.variableDefinitions.add(graphql.language.VariableDefinition.newVariableDefinition(variableRef, new graphql.language.TypeName("PersonFilter")).build());
this.fieldsSet.add("filter");
return this;
}

public Builder queryName(String queryName) {
this.queryName = queryName;
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected.client;

import com.netflix.graphql.dgs.client.codegen.BaseSubProjectionNode;

public class PeopleProjectionRoot<PARENT extends BaseSubProjectionNode<?, ?>, ROOT extends BaseSubProjectionNode<?, ?>> extends BaseSubProjectionNode<PARENT, ROOT> {
public PeopleProjectionRoot() {
super(null, null, java.util.Optional.of("Person"));
}

public PeopleProjectionRoot<PARENT, ROOT> __typename() {
getFields().put("__typename", null);
return this;
}

public PeopleProjectionRoot<PARENT, ROOT> firstname() {
getFields().put("firstname", null);
return this;
}

public PeopleProjectionRoot<PARENT, ROOT> lastname() {
getFields().put("lastname", null);
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected.datafetchers;

import com.netflix.graphql.dgs.DgsComponent;
import com.netflix.graphql.dgs.DgsData;
import com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected.types.Person;
import graphql.schema.DataFetchingEnvironment;
import java.util.List;

@DgsComponent
public class PeopleDatafetcher {
@DgsData(
parentType = "Query",
field = "people"
)
public List<Person> getPeople(DataFetchingEnvironment dataFetchingEnvironment) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected.types;

import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;

public class Person {
private String firstname;

private String lastname;

public Person() {
}

public Person(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}

public String getFirstname() {
return firstname;
}

public void setFirstname(String firstname) {
this.firstname = firstname;
}

public String getLastname() {
return lastname;
}

public void setLastname(String lastname) {
this.lastname = lastname;
}

@Override
public String toString() {
return "Person{firstname='" + firstname + "', lastname='" + lastname + "'}";
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person that = (Person) o;
return Objects.equals(firstname, that.firstname) &&
Objects.equals(lastname, that.lastname);
}

@Override
public int hashCode() {
return Objects.hash(firstname, lastname);
}

public static Builder newBuilder() {
return new Builder();
}

public static class Builder {
private String firstname;

private String lastname;

public Person build() {
Person result = new Person();
result.firstname = this.firstname;
result.lastname = this.lastname;
return result;
}

public Builder firstname(String firstname) {
this.firstname = firstname;
return this;
}

public Builder lastname(String lastname) {
this.lastname = lastname;
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsForInputTypes.expected.types;

import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;

public class PersonFilter {
private String email;

public PersonFilter() {
}

public PersonFilter(String email) {
this.email = email;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

@Override
public String toString() {
return "PersonFilter{email='" + email + "'}";
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PersonFilter that = (PersonFilter) o;
return Objects.equals(email, that.email);
}

@Override
public int hashCode() {
return Objects.hash(email);
}

public static Builder newBuilder() {
return new Builder();
}

public static class Builder {
private String email;

public PersonFilter build() {
PersonFilter result = new PersonFilter();
result.email = this.email;
return result;
}

public Builder email(String email) {
this.email = email;
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type Query {
people(filter: PersonFilter): [Person]
}

type Person {
firstname: String
lastname: String
}

input PersonFilter {
email: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.netflix.graphql.dgs.codegen.java.testcases.constants.constantsWithExtendedInputTypes.expected;

import java.lang.String;

public class DgsConstants {
public static final String QUERY_TYPE = "Query";

public static class QUERY {
public static final String TYPE_NAME = "Query";

public static final String People = "people";

public static class PEOPLE_INPUT_ARGUMENT {
public static final String Filter = "filter";
}
}

public static class PERSON {
public static final String TYPE_NAME = "Person";

public static final String Firstname = "firstname";

public static final String Lastname = "lastname";
}

public static class PERSONFILTER {
public static final String TYPE_NAME = "PersonFilter";

public static final String Email = "email";

public static final String BirthYear = "birthYear";
}
}
Loading
Loading