Skip to content

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

@peterpapas

Description

@peterpapas

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! πŸ™

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions