A
A
Alex00qqw2021-05-01 16:00:38
Java
Alex00qqw, 2021-05-01 16:00:38

How to create a type like Query in GraphQL-Java?

How to create a type like Query in GraphQL-Java?
Guys who worked with GraphQL. Is it possible to create an object of type Query only with a different name?
Our stack:

Spring Boot
java
com.graphql-java-kickstart:graphql-spring-boot-starter

This is what the documentation and schema looks like now:
```

Query

employeeSearch(searchRequest: SearchInput): EmployeeSearchResult
vehicleSearch(searchRequest: SearchInput): VehicleSearchResult

```

I want to structure queries in the documentation and get rid of long query names

at the top level documentation
```
Vehicle
Employee

```

at the Vehicle level
```
Vehicle

vehcile(id: ID!): Vehicle

search(searchRequest: SearchInput): VehicleSearchResult

create(input: CreateVehicleInput): Vehicle

```

at Employee level
```
Employee


employee(id: ID!): Employee

search(searchRequest: SearchInput): EmployeeSearchResult

create(input: CreateEmployeeInput): Employee

```

That is, the idea is to create a type that would resolve at the top level as mutations and queries
```
type Vehicle {
  
  employee(id: ID!): Employee
  
  search(searchRequest: SearchInput): VehicleSearchResult
  
  create(input: CreateVehicleInput): Vehicle
}

```

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question