Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Schema generation error managing object's arrays. #2305

Open
anmiralles opened this issue Nov 26, 2021 · 1 comment
Open

Schema generation error managing object's arrays. #2305

anmiralles opened this issue Nov 26, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@anmiralles
Copy link

  • Module:
    Datasync

  • Version: 1.1.2

  • Node.js / npm versions:

{
  'graphback-templates-mongodb-datasync-runtime': '1.1.2',
  npm: '8.1.0',
  node: '16.13.0',
  v8: '9.4.146.19-node.13',
  uv: '1.42.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.17.2',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1l+quic',
  cldr: '39.0',
  icu: '69.1',
  tz: '2021a',
  unicode: '13.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}
  • Example/snippet of the model that is causing issue

This is the schema we are trying to generate:

type StoreDepartment {
  _id: GraphbackObjectID!
  departmentCode: Int!
}


"""
@model
@datasync(
  ttl: 30000
)
"""
type Store {
  _id: GraphbackObjectID!
  """
  @index(
    name: 'storeCode_index',
    key: {
      storeCode: 1
    }
  )
  """
  storeCode: Int!
  storeName: String
  storeType: String
  departments: [StoreDepartment]
}

scalar GraphbackObjectID

When executing "npm run start" we are getting the following error:

[email protected] start
node dist/index.js

Error: TypeError[StoreDelta.departments]: Provided incorrect OutputType: "[MutateStoreDepartmentInput]"
    at TypeMapper.convertOutputTypeDefinition (/Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/node_modules/graphql-compose/lib/TypeMapper.js:221:15)
    at TypeMapper.convertOutputFieldConfig (/Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/node_modules/graphql-compose/lib/TypeMapper.js:289:29)
    at ObjectTypeComposer.setField (/Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/node_modules/graphql-compose/lib/ObjectTypeComposer.js:215:114)
    at /Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/node_modules/graphql-compose/lib/ObjectTypeComposer.js:225:12
    at Array.forEach (<anonymous>)
    at ObjectTypeComposer.addFields (/Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/node_modules/graphql-compose/lib/ObjectTypeComposer.js:224:28)
    at DataSyncPlugin.addDeltaQuery (/Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/dist/DataSyncPlugin.js:144:22)
    at /Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/dist/DataSyncPlugin.js:43:22
    at Array.forEach (<anonymous>)
    at DataSyncPlugin.transformSchema (/Users/angelmiralles/Temporal/my-awesome-project/node_modules/@graphback/datasync/dist/DataSyncPlugin.js:36:16)

Could you please review and tell us if this is an issue or we have to create the model in other way.

Thanks in advance.

@anmiralles anmiralles added the bug Something isn't working label Nov 26, 2021
@anmiralles
Copy link
Author

Forgot to mention, this already works fine on version 1.0.1

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant