Skip to content

Schema inspection does not catch argument name mismatch #787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
OleBilleAtBS opened this issue Aug 29, 2023 · 2 comments
Closed

Schema inspection does not catch argument name mismatch #787

OleBilleAtBS opened this issue Aug 29, 2023 · 2 comments
Labels
status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@OleBilleAtBS
Copy link

OleBilleAtBS commented Aug 29, 2023

Hi Fellas

Just enabled the schema inspection from #386 and I have a suggestion for additional validation it could make. If the arguments have different names then the ones provided in the schema theyre not mapped when the query is triggered.

Example.

My graphql file.

type Event {
  id: ID!
  name: String!
  description: String
  location: String
}

type Query {
    allEvents(
        first: Int
    ): [Event]
}

My java query resolver

@Controller
@Component
public class EventsQueries {
  @QueryMapping
  public List<Event> allEvents(@Argument Integer anotherName) {
    List<Event> results = new ArrayList<>();
    results.add(new Event(1, "name", "Desc", "Loc"));
    return results;
  }
}

The report looks like this

2023-08-29T14:07:46.959+02:00  INFO 76304 --- [           main] c.e.g.config.GraphQlConfiguration        : GraphQL schema inspection:
	Unmapped fields: {}
	Unmapped registrations: {}
	Skipped types: []

If i trigger a query like this

query {
  allEvents(first:1) {
    id
    name
  }
}

then the "anotherName" value is null. It would be nice if the schema inspection could warn about it.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 29, 2023
@rstoyanchev
Copy link
Contributor

Indeed, currently we don't check arguments and input types, but we could.

@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 1, 2023
@rstoyanchev rstoyanchev added this to the 1.3 Backlog milestone Sep 1, 2023
@rstoyanchev
Copy link
Contributor

This should be covered by #740.

@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
@rstoyanchev rstoyanchev removed this from the 1.3 Backlog milestone Mar 13, 2024
@rstoyanchev rstoyanchev added the status: duplicate A duplicate of another issue label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants