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

How to design around Duplicate schema substructures #1

Open
matthewpeterkort opened this issue Mar 29, 2024 · 0 comments
Open

How to design around Duplicate schema substructures #1

matthewpeterkort opened this issue Mar 29, 2024 · 0 comments

Comments

@matthewpeterkort
Copy link
Collaborator

Something like


endpoint.add({
    name: "DocumentReference",
    schema: [{
        id: "String",
        status: "String",
        resourceType: "String",
        category: [{
            coding: [{
                code: "String",
                display: "String",
                system: "String"
            }]
        }],
        content: [{
            attachment: {
                url: "String"
            }
        }],
        identifier: [{
            system: "String",
            value: "String"
        }],
        type: {
            coding: [{
                code: "String",
                display: "String",
                system: "String"
            }]
        }
    }],
    args: {
        offset: "Int",
        limit: "Int",
        project_id : "String"
    },
    defaults: {
        offset: 0,
        limit: 100
    },
    handler: (G, args) => {
        return G.V().hasLabel("DocumentReference").skip(args.offset).limit(args.limit).toList()
    }
})

Yields a graphql schema error:
message Error building Handler: graphql.NewSchema error: Schema must contain unique named types but contains multiple types named "coding"

Thinking this over a bit, it might make more sense to just split up the schema into 2 different endpoints to avoid this issue entirely.

However, I also think that there is value in creating some additional config or logic that is able to either detect common sub classes and create them at runtime, or be able to specific common classes and use them in the schema configuration.

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

No branches or pull requests

1 participant