Skip to content

AutoConvert Issue: String Field Accepts Object Containing a String #749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
peterpapas opened this issue Apr 2, 2025 · 1 comment
Open

Comments

@peterpapas
Copy link

Describe the bug

Hey Simple-schema team,
First off, thanks for all your amazing work! I've run into a confusing situation and would appreciate some clarification. When using a string field, it seems that passing an object that contains a string (e.g., { foo: 'bar' }) still passes validation. Did I misunderstand how autoConvert works, or is this behavior a bug?

To Reproduce

  • Set autoConvert to true (or leave it at its default setting)
  • Define a field with type String
  • Pass an object containing a string to that field, for example:
    { 'stripeInvoice.invoiceUrl': { foo: 'bar' } }
  • Notice that the validation passes unexpectedly

Expected behavior

I expected the validation to fail when an object is provided, even if it contains a string. I understand that autoConvert performs some conversions for string fields by default when not explicitly disabled, but I assumed that objects with string values would not be automatically converted. Clarification on this behavior would be appreciated.

Screenshots

Image

Versions (please complete the following information):

  • Meteor version: [2.16]
  • Browser: [Chrome]
  • Version: [1.13.1] (I know we haven't been able to upgrade to the latest version, but we will be soon)

Additional context

This is my first ever question on a GitHub repo. Please let me know if any further details are needed. Thanks again for your support! 🙏

Copy link

github-actions bot commented Apr 2, 2025

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously.
Our goal is to provide long-term lifecycles for packages and keep up
with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time.
Therefore, we can't guarantee your issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit
a pull request, too! We will accompany you in the process with reviews and hints
on how to get development set up.

Please also consider sponsoring the maintainers of the package.
If you don't know who is currently maintaining this package, just leave a comment
and we'll let you know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant