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

Can not create column name starting with numbers #1719

Closed
3 tasks done
sadakchap opened this issue May 28, 2021 · 7 comments
Closed
3 tasks done

Can not create column name starting with numbers #1719

sadakchap opened this issue May 28, 2021 · 7 comments

Comments

@sadakchap
Copy link
Member

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Dashboard!

  • You're running version >=1.0.23 of Parse Dashboard.

  • You're running version >=2.3.2 of Parse Server.

  • You've searched through existing issues. Chances are that your issue has been reported or resolved before.

Issue

Can not create columns name starting with numbers. It does not give any information about operation whether it failed or succeeded ( can not see new column added though )

Steps to reproduce

  1. Click on "Add a column"
  2. Enter column name starting with number
  3. Can not see new Column

Please see below gif.
newColumnError

Logs/Trace

In network tab, the request is giving 105 error, saying invalid field name
image

@mtrezza
Copy link
Member

mtrezza commented May 28, 2021

Thanks for reporting.

Let's do the analysis first, for two separate issues:

a) Is the Parse Dashboard validation correct according to Parse Server?
b) What is the reason for Parse Server throwing the error?

For a):
The validation seems to be incorrect if Parse Server according to your example.

For b):
I don't think there is any limitation that prevents from using a key string that contains (or begins with) a number:

  • JavaScript allows any string as key
  • MongoDB allows any string as key as long as it doesn't interfere with reserves symbols, such as $ or operators such as . in dot notation.
  • Parse Server allows - according to docs - any alphanumeric string as key. I haven't found a documented limitation that field names cannot be a string that is (or begins with) a number.

I think we should investigate a) first and then re-evaluate b). Can you look into Parse Server and try to find out why this restriction is in place?

@sadakchap
Copy link
Member Author

sadakchap commented May 30, 2021

It's seems like a validation Error for parse-server, in schemaController.js.

We also have a test case for creating a class with field name starting with numbers, here.

@mtrezza
Copy link
Member

mtrezza commented May 30, 2021

I don't see a reason for prohibiting field names starting with a number. Maybe the blame lines can give more insight into why this is prohibited.

I suggest to open an issue in the parse server repo for this and link to this issue, so we have the investigation in the right repo and for future reference. There may also be existing related issues in the server repo.

@davimacedo
Copy link
Member

It looks it was done on purpose (https://github.com/parse-community/parse-server/blob/9ea355b4635226ae4da17c8cc5fb0321e3fdec5e/src/Controllers/SchemaController.js#L427) but I don't know the reason. I think we should merge this PR anyways, since it is the current status of Parse Server and the PR actually solves a current bug when someone try to create a field stating with a number.

@mtrezza
Copy link
Member

mtrezza commented May 31, 2021

If we merge this, we also need to correct the docs of every SDK to reflect this limitation, because they all currently say that a field name has to be "alphanumeric". And if the SDKs themselves do not have that limitation, maybe they would also need to check client side to not send incorrect field names to the server? So there would be a bunch of changes if we go with that limitation. That is why I suggested to rather look into Parse Server, but I'm also fine with merging #1718 for now.

Whether we merge #1718 or not, I think the clear bug here is that there is no error message displayed when Parse Server rejects adding the field. That should not happen (regardless why it fails) and indicates that there is something wrong with error handling in the dashboard. Maybe that is something that should be addressed in #1718 more importantly than only adding the validation.

I opened an issue on Parse Server: parse-community/parse-server#7409

@mtrezza
Copy link
Member

mtrezza commented May 31, 2021

@davimacedo I looked into the possible reasons for this restrictions and suggest that we keep that restriction in place.

@mtrezza
Copy link
Member

mtrezza commented May 31, 2021

closed via #1718

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

3 participants