Skip to content

How to design around Duplicate schema substructures #1

@matthewpeterkort

Description

@matthewpeterkort

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions