Skip to content

SchemaController.getAllClasses accepts parameter with wrong type #7677

Open
@ThornWu

Description

@ThornWu

New Issue Checklist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions