Skip to content
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

@EntityMapping method cannot resolve Kotlin List argument #1018

Closed
klys-equinix opened this issue Jun 25, 2024 · 3 comments
Closed

@EntityMapping method cannot resolve Kotlin List argument #1018

klys-equinix opened this issue Jun 25, 2024 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@klys-equinix
Copy link

I have a method with signature:

@EntityMapping
    fun floors(
        representations: List<Map<String, Object>>
    ): Flux<Floors>

Calling it like this:

query MyQuery {
  _entities(representations: [{code: "AM5", name: "0G", __typename: "Floors"}]) {
    ... on Floors {
      __typename
      code
      name
      spatialFloorId
    }
  }
}

Causes an error:

{
  "errors": [
    {
      "message": "Could not resolve parameter [0] in public final reactor.core.publisher.Flux<com.equinix.vdc.spatial.generated.graphql.model.Floors> com.equinix.vdc.spatial.controller.floor.FloorsController.floors(java.util.List<? extends java.util.Map<java.lang.String, ?>>): No suitable resolver",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "_entities",
        0
      ],
      "extensions": {
        "classification": "INTERNAL_ERROR"
      }
    }
  ],
  "data": {
    "_entities": [
      null
    ]
  }
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 25, 2024
@klys-equinix
Copy link
Author

Binding with the DataFetchingEnvironment works fine:

@EntityMapping
    fun floors(
        env: DataFetchingEnvironment
    ): Flux<Floors>

And i can see that this env contain correct representations in debugger, but i cannot access them since the EntityBatchDataFetchingEnvironment is not public

@klys-equinix
Copy link
Author

klys-equinix commented Jun 25, 2024

This is working correctly if i force kotlin to use Java collections:

@EntityMapping
    fun floors(
        env: DataFetchingEnvironment,
        representations: java.util.List<Map<String, String>>
    ): Flux<Floors>

Seems like the issue is in

EntityArgumentsMethodArgumentResolver::supportsParameter

@rstoyanchev rstoyanchev self-assigned this Jun 26, 2024
@rstoyanchev rstoyanchev added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 26, 2024
@rstoyanchev rstoyanchev added this to the 1.3.2 milestone Jun 26, 2024
@rstoyanchev rstoyanchev changed the title Could not resolve parameter for @EntityMapping representations @EntityMapping method cannot resolve Kotlin List argument Jun 26, 2024
@rstoyanchev
Copy link
Contributor

There is a fix in 1.3.2-SNAPSHOT now if you'd like to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants