How to use the webiny-model.ObjectAttribute function in webiny-model

To help you get started, we’ve selected a few webiny-model examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / webiny-api / src / attributes / convertToGraphQL.js View on Github external
type = GraphQLBoolean;
    }

    if (attr instanceof attrs.IntegerAttribute) {
        type = GraphQLInt;
    }

    if (attr instanceof attrs.FloatAttribute) {
        type = GraphQLFloat;
    }

    if (attr instanceof attrs.ArrayAttribute) {
        type = new GraphQLList(GraphQLJSON);
    }

    if (attr instanceof attrs.ObjectAttribute) {
        type = GraphQLJSON;
    }

    if (attr instanceof ModelAttribute) {
        const model = attr.getModelInstance();
        type =
            schema.getType(model.classId) ||
            convertModelToType(model.classId, { type: "model" }, model.getAttributes(), schema);
    }

    if (attr instanceof ModelsAttribute) {
        const model = attr.getModelInstance();
        type = new GraphQLList(
            schema.getType(model.classId) ||
                convertModelToType(model.classId, { type: "model" }, model.getAttributes(), schema)
        );