parse-community / parse-community/parse-server

Parse.Schema save method has invalid return type

Open
#9,290 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Issue Checklist
Issue Description

Parse.Schema save method documentation says that this method has the return type of Promise<Parse.Schema> but in reality it its Promise<Parse.RestSchema>
these two objects have totally different methods and properties and can not be used interchangeably.

Steps to reproduce
let schema : Parse.Schema = new Parse.Schema("MyClass");
schema = await schema.save();
const restSchema : Parse.RestSchema  = await schema.get();
Actual Outcome

This sample code is completely acceptable by Typescript but in runtime throws an error, stating that schema object does not have a get method.

Expected Outcome

The return type should match what is actually returned. Either by changing Docs or Code.

Environment

Server

  • Parse Server version: 7.2.0
  • Operating system: Microsoft Windows 11
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 6.0.16
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local (Docker)

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
  • SDK version: 5.3.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Parse.Schema.save and Parse.Schema.get entry points, then compare the documented and declared return types with the runtime value shown in the reproduction. Done means the public type information and documentation agree with the value returned by save, and the sample no longer permits the invalid assignment.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.