function getSchemaTypeInfo()

in templates/JSResolverOCHTTPS.js [301:353]


function getSchemaTypeInfo(lastTypeName, typeName, pathName) {
    const r = {
        name: typeName,
        type: '',
        typeAlias: '',
        pathName: pathName + '_' + typeName,
        isArray: false,
        isRelationship: false,
        relationship: {edgeType: '', direction: 'IN'},
        graphQuery: null
    };

    schemaDataModel.definitions.forEach(def => {
        if (def.kind === 'ObjectTypeDefinition') {
            if (def.name.value === lastTypeName) {
                def.fields.forEach(field => {
                    if (field.name.value === typeName) {
                        // isArray
                        if (field.type.kind === 'ListType') {
                            r.isArray = true;
                            r.type = field.type.type.name.value;
                        }
                        if (field.type.kind === 'NamedType') {
                            r.isArray = false;
                            r.type = field.type.name.value;
                        }
                        // isRelationship
                        if (field.directives.length > 0) {
                            field.directives.forEach(directive => {
                                if (directive.name.value === 'relationship') {
                                    r.isRelationship = true;
                                    directive.arguments.forEach(arg => {
                                        if (arg.name.value === 'type' || arg.name.value === 'edgeType') {
                                            r.relationship.edgeType = arg.value.value;
                                        }
                                        if (arg.name.value === 'direction') {
                                            r.relationship.direction = arg.value.value;
                                        }
                                    });
                                }
                            });
                        }
                    }
                });
            
            }
        }
    });

    r.typeAlias = getTypeAlias(r.type);

    return r;
}