In response of #5894
I would like to propose and discuss the introduction of an SDL system. The main objective will be to help developers improve their GraphQL Server Parse and enable many more features in the future without modifying the Parse Server Core.
const parseGraphQLServer = new ParseGraphQLServer(
parseServer,
{
typeDefs: './schema.graphql'
graphQLPath: '/graphql',
playgroundPath: '/playground'
}
);
@auto: Describe a current Parse class and add auto generationAll other fields will be auto generated
schema.graphql
type Job @auto {
# Tell to GraphQL that the countries array is a an array of countries
countries: [Countries]
}
@disableMutations: Disable all mutation or some mutations on the typeschema.graphql
type Job @auto @disableMutations {
countries: [Countries]
}
OR
type Job @auto @disableMutations(update, delete) {
countries: [Countries]
}
@disableQueries: Disable all queries or some queries on the typeschema.graphql
type Job @auto @disableQueries {
countries: [Countries]
}
OR
type Job @auto @disableQueries(get) {
countries: [Countries]
}
@private: Do not expose a type or a field (in query and input)schema.graphql
type Job @private
type Job @auto {
# Tell to GraphQL that the countries array is a an array of countries
countries: [Countries]
secretData: String @private
}
@lock: Create/update a Parse.Schema and lock the Class schemaWe will create/update the appropriate Parse.Schema. A new way to use Parse.Schema
type Job @lock {
name: String
countries: [Countries]
}
@mock: Allow to generate fake datas in dev modeconst parseGraphQLServer = new ParseGraphQLServer(
parseServer,
{
mock: true,
typeDefs: './schema.graphql'
graphQLPath: '/graphql',
playgroundPath: '/playground'
}
);
type Job @lock {
name: String @mock(["Developer", "FullStack", "Driver"])
countries: [Country]
}
type Country @lock {
name: String @mock(["Developer", "FullStack", "Driver"])
surface: String @mock(["34 000 000km2"])
}
type Job @lock {
# Here it's a comment displayed on the GraphQL Doc
name: String
# Here it's another comment
countries: [Country]
}
Mutation loadSchema that allow to send this schema to the serverNeed Master Key
type Mutation {
loadSchema(schema: String): Boolean
}
What do you think about this @davimacedo ?
We already have similar functionalities (but they are not in the docs yet). Have you seen these PRs?
https://github.com/parse-community/parse-server/pull/5782
https://github.com/parse-community/parse-server/pull/5821
https://github.com/parse-community/parse-server/pull/5836
https://github.com/parse-community/parse-server/pull/5828
My worry with this project is that it's going to get lost pretty quickly due to a lack of balance between documentation and improvement. I think we should create some balance before things go out of hand.
@GoGross I also have this concern. Communicating the features really well through the docs is as important as creating new features. I had actually started building the docs for these PRs but, because of the recent GraphQL discussions around changing the current API, I left it on hold until we have done the breaking changes we expect. But any help here is really appreciated and I think we could accelerate the missing docs. Would be willed to help us on this?
I think that PRs concerning the configuration of the Parse GraphQL Server should only be validated with a linked PR Doc to avoid a implementation mismatch 馃殌
Yes. That's also a good idea. Let's do this for the next PRs.
Most helpful comment
@GoGross I also have this concern. Communicating the features really well through the docs is as important as creating new features. I had actually started building the docs for these PRs but, because of the recent GraphQL discussions around changing the current API, I left it on hold until we have done the breaking changes we expect. But any help here is really appreciated and I think we could accelerate the missing docs. Would be willed to help us on this?