Schemas endpoint: ignore '_metadata' key, convert 'map' type to Object #256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks to everyone working so hard on parse-server!
Legacy Parse platform databases may have additional fields that aren't supported in the current
database-to-api-response conversion. This PR accounts for some discrepancies that appear in schemas created on the Parse platform, and newer schemas created with parse-server. For example, here's a _Role schema created on legacy Parse:
and here's one created with parse-server:
_metadata
field doesn't appear in the api-response versionof Schema. Its value (an object), crashes the conversion function,
because it isn't a string, so it doesn't have a
startsWith
function.object
type. It was added to Schema in Added map to schema object types, fixed expiresAt #87, but it isn't incorporated into the conversion.There may be more exceptions that these, and it may make sense to make the conversion more robust to unexpected values, rather than just adding an exception for
_metadata
. But this seems like a sensible place to start.No tests, because existing tests create objects using parse-server, and those objects don't have the problematic keys. I'd love to add some, but not sure what would be the best approach.