typesense / gatsby-plugin-typesense

A Gatsby plugin to automatically index content to Typesense post-build
Apache License 2.0
34 stars 11 forks source link

2: plugin only works with string field type #3

Closed nonapod closed 4 years ago

nonapod commented 4 years ago

Change Summary

Pertains to issue: https://github.com/typesense/gatsby-plugin-typesense/issues/2

Adds a new function to gatsby-node.js called typesenseGetValue, which checks the field type and converts the value to the correct type:

This works with a list of values and with singular values i.e. float & float[]

PR Checklist

jasonbosco commented 4 years ago

@nonapod Good catch and thank you for the PR! Looks good for the most part, I left some comments.

I've also updated CircleCI settings to run tests on PRs from forks, so the next commit you push to this branch should hopefully trigger tests automatically.

nonapod commented 4 years ago

@nonapod Good catch and thank you for the PR! Looks good for the most part, I left some comments.

I've also updated CircleCI settings to run tests on PRs from forks, so the next commit you push to this branch should hopefully trigger tests automatically.

Hi @jasonbosco I've made a change or two to the tests however it looks like I'm running into this issue: Failed: "[Typesense] Could not create collection pages_v1_1606802095152: TypeError: Cannot read property 'message' of undefined"

Would you have any immediate suggestions for this? If not I can dig in locally here and give it a crack. Thanks!

jasonbosco commented 4 years ago

Awesome! Thank you.

The (unfortunately unhelpful) error message you’re seeing shows up when an axios mock is missing in the tests and an actual request is attempted. I can take a closer look tomorrow.

On Mon, Nov 30, 2020 at 10:13 PM Les Cordell notifications@github.com wrote:

@nonapod https://github.com/nonapod Good catch and thank you for the PR! Looks good for the most part, I left some comments.

I've also updated CircleCI settings to run tests on PRs from forks, so the next commit you push to this branch should hopefully trigger tests automatically.

Hi @jasonbosco https://github.com/jasonbosco I've made a change or two to the tests however it looks like I'm running into this issue: Failed: "[Typesense] Could not create collection pages_v1_1606802095152: TypeError: Cannot read property 'message' of undefined"

Would you have any immediate suggestions for this? If not I can dig in locally here and give it a crack. Thanks!

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/typesense/gatsby-plugin-typesense/pull/3#issuecomment-736247071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADP5DYDMRN356BBXG35WGTSSSCO5ANCNFSM4UHCW5EA .

-- Jason Bosco Co-founder Typesense

jasonbosco commented 4 years ago

@nonapod Turns out the mock was missing one more field, which is why the test failed. I've added it here: https://github.com/typesense/gatsby-plugin-typesense/pull/3/commits/7bcb6e46749573d5ddd9935411075e0805595457#diff-bfc1a899a2cb64cb566a7038666804adc7ffce33432f942bfdba634769ecd5d9R130

To make debugging easier in the future, I've also enabled verbose logging in the tests, so we'll know the last request that was made. We can then use that to know which mock has the issue.

Thank you again for the PR! I'll merge it in shortly.

jasonbosco commented 4 years ago

I've published this to NPM as v0.2.0.

nonapod commented 4 years ago

@nonapod Turns out the mock was missing one more field, which is why the test failed. I've added it here: 7bcb6e4#diff-bfc1a899a2cb64cb566a7038666804adc7ffce33432f942bfdba634769ecd5d9R130

To make debugging easier in the future, I've also enabled verbose logging in the tests, so we'll know the last request that was made. We can then use that to know which mock has the issue.

Thank you again for the PR! I'll merge it in shortly.

Thanks @jasonbosco will help out in future if I encounter anything else!