parse-community / parse-community/parse-server
SchemaController.getAllClasses accepts parameter with wrong type
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
When I was reading the source code, I found two mistakes when calling SchemaController.getAllClasses.
getAllClasses accepts a object with a key named clearCache.
getAllClasses(options: LoadSchemaOptions = { clearCache: false })
But there are two places calling this function with a boolean value.
No.1
In src/Routers/SchemasRouter.js#L19
function getAllSchemas(req) {
return req.config.database
.loadSchema({ clearCache: true })
.then(schemaController => schemaController.getAllClasses(true)) // => #L19
.then(schemas => ({ response: { results: schemas } }));
}
No.2
In /src/GraphQL/loaders/schemaQueries.js#L63
const schema = await config.database.loadSchema({ clearCache: true });
return (await schema.getAllClasses(true)).map(parseClass => ({ // => #L63
name: parseClass.className,
schemaFields: transformToGraphQL(parseClass.fields),
}));
Environment
Server
- Parse Server version: 5.0.0-beta.1
Logs
n/a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading getAllClasses and its LoadSchemaOptions declaration, then inspect the calls in src/Routers/SchemasRouter.js and src/GraphQL/loaders/schemaQueries.js. Verify that both REST schema loading and GraphQL schema loading use the expected parameter shape rather than a boolean, and confirm both callers still return their documented schema results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100