parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Parse.Schema save method has invalid return type

Open alino20 opened this issue 1 year ago • 2 comments

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

alino20 avatar Aug 21 '24 18:08 alino20

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@Moumouls Is this actually a bug?

mtrezza avatar Oct 08 '24 13:10 mtrezza