Skip to main content

orchardcore-graphql

Skill for configuring and using the GraphQL API in Orchard Core. Covers GraphQL queries, custom types, content type querying, and GraphQL schema customization. Use this skill when requests mention Orchard Core GraphQL, Configure and Use GraphQL API, Enabling GraphQL Features, Basic Content Query, Query with Filtering, Query with Pagination, or closely related Orchard Core implementation, setup, extension, or troubleshooting work. Strong matches include work with OrchardCore.Apis.GraphQL, OrchardCore.ContentManagement, OrchardCore.Apis, MyPart, MyField, MyPartIndexAliasProvider, IIndexAliasProvider, MyPartIndex, IEnumerable, IServiceCollection, WhereInput. It also helps with graphql examples, Query with Filtering, Query with Pagination, Query Specific Content Item, plus the code patterns, admin flows, recipe steps, and referenced examples captured in this skill.

Stars
13
Source
CrestApps/CrestApps.AgentSkills
Updated
2026-05-29
Slug
CrestApps--CrestApps.AgentSkills--orchardcore-graphql
View on GitHubRaw SKILL.md

// install — copy + paste into any project

mkdir -p .claude/skills && curl -fsSL https://raw.githubusercontent.com/CrestApps/CrestApps.AgentSkills/HEAD/plugins/orchardcore/skills/orchardcore-graphql/SKILL.md -o .claude/skills/orchardcore-graphql.md

Drops the SKILL.md into .claude/skills/orchardcore-graphql.md. Works with Claude Code, Cursor, and any agent that loads SKILL.md files from .claude/skills/.

Orchard Core GraphQL

Enable OrchardCore.Apis.GraphQL for /api/graphql. The endpoint requires ExecuteGraphQL; mutations additionally require ExecuteGraphQLMutations. Content access is also limited by the caller's content-view permissions. A JWT bearer principal must therefore receive the same Orchard permissions through its user or role before it can query content.

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.Apis.GraphQL"
      ]
    }
  ]
}

Use GraphiQL in the admin UI to inspect the schema and generated field names. Do not embed a fictional Liquid graphql tag; execute GraphQL through its HTTP endpoint or application code.

Graph Types and Where Filters

InputObjectGraphType<T> models an ordinary input object. It does not automatically create predicate suffixes such as _contains. For indexed content filtering, derive from WhereInputObjectGraphType<T> and use its filter-field helpers.

using GraphQL.Types;
using Microsoft.Extensions.Localization;
using OrchardCore.Apis.GraphQL.Queries;

namespace MyModule;

public sealed class ProductWhereInput : WhereInputObjectGraphType<ProductIndex>
{
    public ProductWhereInput(IStringLocalizer<ProductWhereInput> localizer)
        : base(localizer)
    {
        AddScalarFilterFields<StringGraphType>(
            fieldName: nameof(ProductIndex.Sku),
            description: "Product SKU",
            aliasName: "Product",
            contentPart: "ProductPart",
            contentField: "Sku");
    }
}

Register a map index with the dedicated extension:

services.AddWhereInputIndexPropertyProvider<ProductIndex>();

Index Aliases

IIndexAliasProvider is asynchronous in v3:

using OrchardCore.ContentManagement.GraphQL.Queries;

namespace MyModule;

public sealed class ProductIndexAliasProvider : IIndexAliasProvider
{
    public ValueTask<IEnumerable<IndexAlias>> GetAliasesAsync()
    {
        IEnumerable<IndexAlias> aliases =
        [
            new IndexAlias
            {
                Alias = "Product",
                Index = nameof(ProductIndex),
                IndexType = typeof(ProductIndex),
            },
        ];

        return ValueTask.FromResult(aliases);
    }
}

Register it with its intended lifetime:

services.AddScoped<IIndexAliasProvider, ProductIndexAliasProvider>();