Home

Awesome

This is a demo for Moqui GraphQl

This demo depends on:

tl;dr

git clone https://github.com/moqui/moqui-framework

cd moqui-framework
./gradlew getRuntime

git clone https://github.com/shendepu/moqui-graphql ./runtime/component/moqui-graphql
git clone https://github.com/shendepu/moqui-graphql-demo ./runtime/component/mqoui-graphql-demo
 
./gradlew run 

First open http://localhost:8080 and login with john.deo test account

then open http://localhost:8080/graphql/GraphiQL

Note: It seems safari has issue to show variable panel of GraphiQL. Chrome and firefox are fine.

input

query QueryType($showUsers: Boolean!) {
  moqui {
    users (pagination: {pageSize: 2}) @include(if: $showUsers) {
      edges {
        node {
          userId 
          username
          emailAddress
        }
      }
    }
    user(userId: "EX_JOHN_DOE") {
      userId
      username
      userFullName
    }

    entity {
      syncs {
        edges {
          node {
          	entitySyncId
          }
        }
      }
    }
    basic {
      geos (pagination: {pageSize: 4 }) {
        edges {
          node {
            geoId
            geoName
          }
        }
        pageInfo {
          totalCount
        }
      }
    }
  }
}

also add query variables

{
  "showUsers": true
}

mutation

mutation {
  graphqlDemo {
    createPerson (input:{
      firstName: "Dummy"
      lastName: "Dude"
    }) {
      id
      partyId
    	partyTypeEnumId
      ... on Person {
        firstName
        lastName
      }
    }
  }
}

You may try modifying the query to see different result

Snapshot

GraphiQL