These are chat archives for reactioncommerce/reaction

19th
Jul 2017
🍌 Stephen Keep 🍌
@stephenkeep_twitter
Jul 19 2017 07:59
is it possible to bundle the client files in a cordova app using the normal meteor commands? I have tried but it seems that it misses a few steps and the page does not load.
would it be a case of modifying the reaction cli or is there a deeper issue that needs resolving?
Aaron Judd
@aaronjudd
Jul 19 2017 13:52
@stephenkeep_twitter that should be possible, we’ve done it long ago, but not recently. I think you need to add configuration for the loading screens if I remember right… maybe someone else has built for ios lately? (we are usually only compiling for browser). See: https://guide.meteor.com/mobile.html
@adi-ads yes, see the marketplace branch
danielpinna
@danielpinna
Jul 19 2017 14:37

Hello people,
I added a new field to my product. After you add this new field, the reaction does not start any longer, it is displaying validation errors.

Error: Match Error: Failed Match.OneOf, Match.Maybe, or Match.Optional Validation

Does anyone know where product validation is when initializing the reaction?

Aaron Judd
@aaronjudd
Jul 19 2017 15:23
Schemas are located in /lib/collections/schemas -> https://docs.reactioncommerce.com/reaction-docs/master/simple-schema
danielpinna
@danielpinna
Jul 19 2017 15:26

@aaronjudd
Hello Aron,
Thanks for the answer. But what exactly do I look for where the validations of the schemes are made?
I created a new field and added it to a product collection, only that after my application does not go up anymore. I get the error below:

Error: Match Error: Failed Match.OneOf, Match.Maybe, or Match.Optional Validation

If you have any other tips

danielpinna
@danielpinna
Jul 19 2017 16:26

Folks,

In the documentation there are 2 ways to add new fields to a schema:

Extend Schema

and

Adding Field

What's the difference between them? Which is the most appropriate or correct?

Aaron Judd
@aaronjudd
Jul 19 2017 16:27
any other context around the error? (the full error should tell you where the error is being thrown ) -> I can’t really even tell from that snippet if the error is in the product schema (validation of the schema) or that’s a method missing a paramater (the other most common use of Match and schema validation). When you say you added a new field to the product, did you add to the schema, did you modify products.json?
danielpinna
@danielpinna
Jul 19 2017 16:28
@aaronjudd
Yes a have
/home/oi395010/.meteor/packages/meteor-tool/.1.5.0.utbu0o++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
                        throw(ex);
                        ^
Error: Match error: Failed Match.OneOf, Match.Maybe or Match.Optional validation
    at exports.check (packages/check.js:56:15)
    at _registerInventory (imports/plugins/included/inventory/server/methods/inventory.js:16:3)
    at imports/plugins/included/inventory/server/startup/init.js:12:21
    at server/api/hooks.js:60:1
    at Array.reduce (native)
    at Object.Hooks.Events.run (server/api/hooks.js:60:1)
    at Object.init (server/api/core/core.js:45:18)
    at server/startup/init.js:15:2
    at server/startup/index.js:18:2
    at server/main.js:8:2
    at Function.time (/home/oi395010/laboratory/reaction/.meteor/local/build/programs/server/profile.js:309:28)
    at /home/oi395010/laboratory/reaction/.meteor/local/build/programs/server/boot.js:347:13
    at /home/oi395010/laboratory/reaction/.meteor/local/build/programs/server/boot.js:388:5
    at Function.run (/home/oi395010/laboratory/reaction/.meteor/local/build/programs/server/profile.js:510:12)
    at /home/oi395010/laboratory/reaction/.meteor/local/build/programs/server/boot.js:386:11
=> Exited with code: 1
andela-dbamidele
@andela-dbamidele
Jul 19 2017 16:30
@aaronjudd
I created a new product and I noticed that the price range is not displaying like the basic example product. I traced the issue to the database and I discovered that the price was saved not as an object as opposed to the default product. Is there any fix to this?
ereyes97
@ereyes97
Jul 19 2017 16:34

@danielpinna @aaronjudd

This was a conversation I had yesterday with Brend Hoover. I think it is the same issue...

Brent Hoover
@zenweasel
Jul 18 17:24
https://github.com/reactioncommerce/reaction/blob/b277f14f66fed84a2f0b322bc11db7266ac9a79d/imports/plugins/included/inventory/server/methods/inventory.js#L15-L15
Are you trying to make significant changes to the schema?
ereyes97
@ereyes97
Jul 18 17:26
Yes, overwriting ProductVariant... and it just the begining :smile:
Brent Hoover
@zenweasel
Jul 18 17:28
Right now our API for making schema changes is pretty limited. It’s fine for adding a couple of fields here and there but if you need to make significant changes I would probably suggest just changing the core schema. We have plans to rewrite this so that you can override any schema but that probably won’t be for a couple of months at least, and then you would be able to easily migrate to that.

Aaron Judd
@aaronjudd
Jul 19 2017 16:34
can’t claim to know which approach is better on the schema, I wrote one of those docs though lol. I’ve traditionally used the extend method, as most of my use cases have been adding some unique fields for packages. I’d think these two approaches do the same thing though, in one case you’re merging the schema object in the schema definition, and it’s local. The other is additive, I am not sure though - a benefit might be the attachSchema method may work to make the schema global (candidly though, not sure about that, as this is an issue we’ve been looking for an elegant solution to).
@ereyes97 yup.. :thumbsup:
@danielpinna so the match is failing here:
export function registerInventory(product) {
  check(product, Match.OneOf(Schemas.ProductVariant, Schemas.Product));
danielpinna
@danielpinna
Jul 19 2017 16:38
That's it, I came this far. I tried to add my new scheme, but this did not work
Aaron Judd
@aaronjudd
Jul 19 2017 16:39
did you just trying modifying the core schema, and discard your attempt to extend for testing purposes?
just to make sure your data and the schema modification match up?
danielpinna
@danielpinna
Jul 19 2017 16:41

I'm just trying to add a new field to the product schema. I tried both making an extension, and making an addition.

In both cases I did not succeed.

Aaron Judd
@aaronjudd
Jul 19 2017 16:42
or did you?
sort of my point.. does your data match your changed schema...
danielpinna
@danielpinna
Jul 19 2017 16:44

Do you think this error is happening, because it is inserting products, which do not correspond to my new type of schema?

It's a good track ....
Plus I've put this new field as an optional .... Do you think even then, can you generate this error?

Aaron Judd
@aaronjudd
Jul 19 2017 16:48
I’d go about figuing this out this way: revert your data…. does the import then pass? Great. Change the core schema, make your new field required, run import -> does it fail because the data doesn’t match? Great, the schema is working. Revert that, but now extend the schema in your plugin, using the attachSchema method. Does that work? if it doesn’t it’s due to load order and the schema wasn’t attached before the import runs. In this case, you may have to live with a changed core file until we figure out a solution to that particular problem. Once you got the schema working, now change your data, revert the field to optional again.
danielpinna
@danielpinna
Jul 19 2017 16:51

Okay, thanks for the tips. I'll follow and see what works best.

One last point, when I put this new field in the product schema will it be displayed on the product registration screen automatically? If not, do you know which screen I should change to display the new field?

thank you

ereyes97
@ereyes97
Jul 19 2017 16:51
It would be great to have a tutorial for changes in schemas like this.
andela-dbamidele
@andela-dbamidele
Jul 19 2017 16:53

@aaronjudd
I created a new product and I noticed that the price range is not displaying like the basic example product. I traced the issue to the database and I discovered that the price was saved not as an object as opposed to the default product. Is there any fix to this?

@danielpinna @zenweasel @ereyes97 Any help on this

Aaron Judd
@aaronjudd
Jul 19 2017 16:53
@ereyes97 Agreed. we sort of do, but in several places. And I wish our docs also laid out known pitfalls.. big warning sign, just to tell you when there is a bumpy road ahead ;-) @machikoyasuda what say you?
@andela-dbamidele I feel like there was just an issue on this? is this #2521
Juras Norkus
@jnorkus
Jul 19 2017 17:24
Guys, how do you override the layoutHeader or layoutFooter values? I've spent two days already trying to change the layout without luck, almost feel like giving up. Any help appreciated!
ereyes97
@ereyes97
Jul 19 2017 18:10

@jnorkus
Hi Juras. I have not done that yet... RC is new for me too, but yesterday at the conference Jeremy shows a new features for plugins it is not exactly your question but I think it would be nice if you take a look.
https://www.crowdcast.io/e/reaction-action-july

others links
https://docs.reactioncommerce.com/reaction-docs/master/plugin-intro-1
https://docs.reactioncommerce.com/reaction-docs/master/plugin-customizing-templates-4

Aaron Judd
@aaronjudd
Jul 19 2017 18:52
The new registerComponent is available in this PR/branch #2536. (it’s ready for testing, so any and all reviewers are appreciated, we’ll merge when approved to development)