Skip to content
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

Field names can clash with API code, causing errors when creating records #791

Closed
tcrammond opened this issue Mar 16, 2018 · 1 comment · May be fixed by sparkbold/strapi#117, subsy/strapi#84, subsy/strapi#85, sparkbold/strapi#120 or sparkbold/strapi#382
Assignees
Labels
issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve

Comments

@tcrammond
Copy link

Node.js version:

9.8.0

npm version:

5.7.1

Strapi version:

3.0.0-alpha.11.1

Operating system:

OSX El Capitan

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

If you make a field with a name that clashes with a Model/orm method or property (might be something else, this is a guess), you will be unable to create records using the content type UI.

In my case, I was trying to use a field named "set" on one of my content types. I could not create any more records. Updates still worked fine.

If the current behavior is a bug, please provide the steps to reproduce the problem

  1. using the content type builder, create a content type with a field named "set". Field type doesn't matter, string will work.
  2. Try to create a record using the content type UI. The UI will show flash message "An error occurred during record creation"

The server console reports:

error: undefined

The http response reports:

{"statusCode":400,"error":"Bad Request","message":[{"messages":
[{"id":"This this,set,is,not,a,function is already taken","field":["this","set","is","not","a","function"]
}]}]}

What is the expected behavior?

Either field names like this are prevented from clashing with API code, or are not allowed to be entered in the content type manager at all.

@lauriejim lauriejim self-assigned this Mar 16, 2018
@lauriejim lauriejim added issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around status: have to reproduce labels Mar 16, 2018
@lauriejim
Copy link
Contributor

Hi @tcrammond thank you for this reporting.

@lauriejim lauriejim added severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve and removed severity: medium If it breaks the basic use of the product but can be worked around labels Apr 6, 2018
@lauriejim lauriejim added this to the 3.0.0-alpha.12.3 milestone Apr 19, 2018
@lauriejim lauriejim modified the milestones: 3.0.0-alpha.12.3, 3.0.0-alpha.12.2 May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment