How to make documentId in GraphQL queries optional

Having a custom page slug using strapi5, I want to be able to fetch data with GraphQL by slug, and I made the following changes

import type { Core } from '@strapi/strapi';

export default {
  /**
   * An asynchronous register function that runs before
   * your application is initialized.
   *
   * This gives you an opportunity to extend code.
   */
  register({ strapi }: { strapi: Core.Strapi }) {
    const extensionService = strapi.plugin('graphql').service('extension');

    const extension = ({ nexus }) => ({
      typeDefs: `
        type Query {
          documentId: ID
          page(slug: String): Page
        }
      `,
      resolvers: {
        Query: {
          page: {
            resolve: async (parent, args, context) => {

              const { toEntityResponse } = strapi.service(
                "plugin::graphql.format"
              ).returnTypes;

              const data = await strapi.services["api::page.page"].find({
                filters: { slug: args.slug },
              });

              const response = toEntityResponse(data.results[0]);
              return response;
            },
          },
        },
      },
    })
    extensionService.use(extension)
  },

  /**
   * An asynchronous bootstrap function that runs before
   * your application gets started.
   *
   * This gives you an opportunity to set up your data model,
   * run jobs, or perform some special logic.
   */
  bootstrap(/* { strapi }: { strapi: Core.Strapi } */) { },
};
```
However documentId is required field. How can I make that optional?

<i>This topic has been created from a Discord post (1237825913304125490) to give it more visibility.
It will be on Read-Only mode here.
<a href="https://discord.com/channels/811989166782021633/1237825913304125490/1237825913304125490">Join the conversation on Discord</a></i>

It looks like documentId already is optional, seeing as there isn’t a “!” at the end of it. You don’t have a resolver for it though, which might be causing the error when you query it. I’m not a GraphQL expert though so I could be missing other details.

Unfortunately, that attempt did not work as I still have the documentId as a required argument. However, I used another workaround by making a query on pages where I can use the filters, and then I have to target the first element in the array.