Skip to content

Schema inspection reports skipped type when field is mapped to property with generic type #1037

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
luis22737928 opened this issue Jul 25, 2024 · 3 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@luis22737928
Copy link

luis22737928 commented Jul 25, 2024

Hello, I have come across the following issue... I have a controller that returns a typed class (DataRep) and in this class there is a collection of T.

Here is the schema definition:

type Genero {
    id: Int
    descripcion: String
}

type PagGenero {
    listado: [Genero]
}

Here is the controller:

@QueryMapping
public DataResp<Genero> getGenerosPag(@Argument(name = "dataReq") _GeneroDataReqInput dataReq) {
        return generoService.findByUsuarioActual(dataReq);
}

And here is the class returned DataResp:

public class DataResp<T> {
    protected List<T> listado = new ArrayList<>();

    public DataResp(List<T> listado) {
        this.listado = listado;
    }
}

Everything works fine, but the inspection report cannot recognize the type of the collection and reports Genero as a skipped type:

GraphQL schema inspection:
	Unmapped fields: {}
	Unmapped registrations: {}
	Unmapped arguments: {}
	Skipped types: [Genero]

Is there a way to make introspection recognize this mapping between the collection declared in the schema and the one returned? thank you in advance

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

Can you show the Query type in the schema? In other words, what the output type for the getGenerosPag query is, and how DataResp<Genero> is mapped to that.

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label Sep 4, 2024
@luis22737928
Copy link
Author

Here is the schema definition:

type Genero {
    id: Int
    descripcion: String
}

type PagGenero {
    totalFilas: Int
    filasPorPagina: Int
    numeroDePagina: Int
    totalPaginas: Int
    listado: [Genero]
    msj: String
}

extend type Query {
    getGenerosPag(dataReq: GeneroDataReqInput): PagGenero
}

The type PagGenero is assigned to the returned class DataResp< T >, where the type Genero is assigned to the parameter class T.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 4, 2024
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Sep 5, 2024

Okay so the issue seems to be with a field that is mapped to a property with a generic type.

@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Sep 5, 2024
@rstoyanchev rstoyanchev added this to the 1.3.3 milestone Sep 5, 2024
@rstoyanchev rstoyanchev changed the title Schema inspection report skips types when controller returns generic class Schema inspection reports skipped type when field is mapped to property with generic type Sep 5, 2024
@rstoyanchev rstoyanchev self-assigned this Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants