-
-
Notifications
You must be signed in to change notification settings - Fork 596
Add Bytes type to Parse.Schema #1503
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
Comments
Thanks for opening this issue!
|
Where is the |
mmm I assumed that Parse-server supports that, Baker did some implementation in Swift parse-community/Parse-Swift#190 and the test sample creates an object type Bytes the parse js sdk schema shows the
|
Yes, the type is there, but I don't know how widely it is supported; it doesn't seem to be documented and how would Parse Dashboard even display that field if the field type does not seem to exist there? These are more general questions, not necessarily related to your new issue. |
I see, so it shows just the raw JSON data, like a custom data type - neat. |
I personally not sure if I need/will ever use Bytes, I just saw something that "was missing" and I wanted to report it, just in case someone had free time to implemented it.. |
You'd need to look into Parse Server if there is a |
I think the benefits of My guess would be It definitely works as I tested it when adding it to the Swift SDK. |
@mtrezza I believe there are additional benefits as the data is stored in the DB as bytes. See here: https://community.parseplatform.org/t/saving-byte-data-to-parseobject/1804/8?u=cbaker6 |
I think you are right with it being overlooked, it's been there for a long time, presumably since open-sourcing looking at git blame. We need some care when expanding / building upon this half-implemented feature. At least Parse Dashboard seems to be able to handle this field type, but an SDK may crash if the data type is unknown and not properly handled. Something we could do immediately is adding this type to the docs with a note that it's not fully implemented across client SDKs and Parse Dashboard (can only display but not set field type), use at own risk. So the fact that Parse.Schema doesn't support it is an actual issue. Well uncovered, @MrMartinR! Would you want to open a docs PR to add a note about this data type? This could bring some clarity for people who are researching this. |
Implementing this into Schema for the JS SDK would require looking here: Parse-SDK-JS/src/ParseSchema.js Lines 18 to 30 in 8115e95
The Swift SDK counterpart is here: /// Field types available in `ParseSchema`.
public enum FieldType: String, Codable {
/// A string type.
case string = "String"
/// A number type.
case number = "Number"
/// A boolean type.
case boolean = "Boolean"
/// A date type.
case date = "Date"
/// A file type.
case file = "File"
/// A geoPoint type.
case geoPoint = "GeoPoint"
/// A polygon type.
case polygon = "Polygon"
/// An array type.
case array = "Array"
/// An object type.
case object = "Object"
/// A pointer type.
case pointer = "Pointer"
/// A relation type.
case relation = "Relation"
/// A bytes type.
case bytes = "Bytes"
/// A acl type.
case acl = "ACL"
} Of course tests will be needed in the JS SDK side. You should be able to copy/modify this test for Bytes: Parse-SDK-JS/src/__tests__/ParseSchema-test.js Lines 95 to 105 in 8115e95
|
So I'll label this as a feature request if we assume that |
Even more interesting that it's not in the JS SDK, which is usually the most complete one. |
If my memory serves me correct, the JS SDK has only been more complete than the Objective-C and Android SDK's in recent years due to open-source maintainers beefing it up and limited contributions to the others. Before that, the other SDKs were more complete than JS. |
I can open a PR for this. Should we all so add support for ParseBytes like in the PHP SDK in the future? |
New Issue Checklist
Issue Description
Is not possible to add a field using Bytes filetype.
VS Code throws an error on the 'Bytes' parameter
Argument of type '"Bytes"' is not assignable to parameter of type 'TYPE | undefined'.ts(2345)
Steps to reproduce
I guess we need something like Parse-Swift feature.
Actual Outcome
On console.log
Uncaught (in promise) Error: Bytes is not a valid type.
Expected Outcome
Not get the error and return the object
Environment
Local environment, using parse-server from the npm
Server
latest
macOS Monterrey
Local
Database
Postgres
14
local
Client
latest
Logs
https://community.parseplatform.org/t/saving-byte-data-to-parseobject/1804/4
parse-community/Parse-Swift#190
Parse-SDK-JS/integration/test/ParseObjectTest.js
Lines 1365 to 1379 in ffc523f
The text was updated successfully, but these errors were encountered: