INNER CODE UNIT · JavaScript

makeGatewaySchema

gmac/schema-stitching-handbook · computed-fields/index.js:9

function makeGatewaySchema() {
  return stitchSchemas({
    subschemas: [
      {
        schema: metadataSchema,
        transforms: [new RemoveObjectFieldDeprecations('gateway access only')],
        batch: true,
        merge: {
          Product: {
            // selectionSet: '{ upc }', << technically not necessary here!
            fields: {
              category: { selectionSet: '{ categoryId }', computed: true },
              metadata: { selectionSet: '{ metadataIds }', computed: true },
            },
            fieldName: '_products',
            key: ({ categoryId, metadataIds }) => ({ categoryId, metadataIds }),
            argsFromKeys: (keys) => ({ keys }),
          }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…