Add content field to WikiPage GraphQL type

What does this MR do and why?

Adds a content field to the WikiPage GraphQL type, resolved from the underlying Git-backed wiki page (calls_gitaly: true).

This is Part A of the wiki GraphQL foundation issue and unblocks the get_wiki_page MCP tool, which needs to return a page's content and has no other way to read it today. Part B (create, update, and destroy mutations) is not needed by that tool and is left for a separate change.

How to test locally

You can either do it via graphql explore, or:

  1. In bundle exec rails console, resolve a wiki page and query it through the schema directly:

    project = Project.find_by_full_path('your-group/your-project')
    page = Wiki.for_container(project, project.first_owner).find_page('home')
    meta = page.find_or_create_meta
    
    query = <<~GRAPHQL
      query($slug: String!, $projectId: ProjectID) {
        wikiPage(slug: $slug, projectId: $projectId) { title content }
      }
    GRAPHQL
    
    GitlabSchema.execute(query, variables: { slug: meta.canonical_slug, projectId: project.to_global_id.to_s }, context: { current_user: project.first_owner }).to_h
  2. Confirm the response includes the page content.

Closes #611519

Edited by Amr Taha

Merge request reports

Loading
Loading