Vulcan icon indicating copy to clipboard operation
Vulcan copied to clipboard

collection.addField not working if schema is simpl-schema

Open EloyID opened this issue 3 years ago • 3 comments

Describe the bug If I create a collection using a schema which is instance of simpl-schema and then I use addField, it won't appear in GraphQL

To Reproduce Steps to reproduce the behavior:

  1. Create a collection using simpl-schema in the schema
  2. Use collection.addField
  3. Try to query/filter by this field

Expected behavior The field to exist

EloyID avatar Apr 06 '21 08:04 EloyID

Try this:

  collection.attachSchema({
    addedField1: {
      type: Boolean,
      . . .
    },
    addedField2: {
      type: Object,
      . . .
    },
  });

ErikDakoda avatar Apr 06 '21 12:04 ErikDakoda

It's already in the addField function and it used to work in the release of november https://github.com/VulcanJS/Vulcan/blob/f5012d16ab272c753efbc159ca44fb829f362f46/packages/vulcan-lib/lib/modules/collections.js#L76-L89

EloyID avatar Apr 06 '21 13:04 EloyID

@EloyID there is a bug in addField that I attempted to fix with a PR but the change was reverted by @SachaG. Here is our discussion about it: https://github.com/VulcanJS/Vulcan/pull/2648 . My solution above is the workaround I am using.

ErikDakoda avatar Apr 06 '21 14:04 ErikDakoda