If I have the following rest endpoints:
GET /organisation/:id < organisation
GET /organisation/:id/form < get all forms associated with an organisation
GET /organisation/:id/form/:slug < get a single form with the designated slug
Is it best practice to organise my GraphQL schema like this? Where providing a slug returns the form in question or without a slug returns the full list of available forms.
type Organisation {
id: String
name: String
forms(slug: String): [Form!]
}
Alternatively is it better to organise like this
type Query {
getOrganisation: Organisation
getFormBySlug(organisationId: ID!, slug: String!): Form
}
Option one feels more GraphQL where the organisation context is provided but feels off in the way that I’m essentially filtering the graph at the child level
Option two feels more restful which is obviously counter to GraphQL