Skip to content

Fragments should generate their own structs #280

@JamesPeters98

Description

@JamesPeters98

When generating a client using fragments and lots of similar queries that use the same fragment it leads to lots of the same structs being generated.

Ideally there would be a seperate Fragments struct that contains the defined fragments.

I.e the following queries would both share the same response structs as they use the same fragment:

fragment LoadInfo on Load {
    loadId
    jobContainerId
    name
    loadPlanStatus
    journey {
        journeyId
    }
}

query loadById($load: Int!) {
    loadByID(loadId: $load) {
        ...LoadInfo
    }
}

query loadBySupplier($supplier: String!, $after: LocalDateTime!) {
    loadsBySupplierId(supplierCode: $supplier, after: $after) {
        ...LoadInfo
    }
}

Not sure how feasible that is, but I think something similar is done for input types and enums?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions