GraphQL shows no schema

74 views Asked by At

I have simple POC for GraphQL, ASP.NET Core Web API and Hot Chocolate packages (HotChocolate.AspNetCore and HotChocolate.Data with v13.8.1):

My initialization code:

        services.AddControllers();
        services.AddEndpointsApiExplorer();
        services.AddSwaggerGen();
        services.AddGraphQLServer()
            .AddQueryType<Queries>()
            .AddProjections();
        services.AddDbContext<DbContext>(); // with InMemory EF

and

    var app = builder.Build();

    app.UseDefaultFiles();
    app.UseStaticFiles();

    // Configure the HTTP request pipeline.
    if (app.Environment.IsDevelopment())
    {
        app.UseSwagger();
        app.UseSwaggerUI();
    }

    app.UseHttpsRedirection();

    app.UseAuthorization();

    app.MapControllers();
    app.MapGraphQL("/graphql");

    app.MapFallbackToFile("/index.html");

    app.Run();

As well as simple queries definition:

    public class Queries
    {
        private readonly DbContext _dbContext;

        public Queries(DbContext dbContext)
        {
           _dbContext = dbContext;
        }

        [UseProjection]
        public IQueryable<TestModel> Read()
        {
            return _dbContext.TestModel;
        }
    }

However, when I run https://localhost:PORT/graphql I see no schemas defined in Schemas (and other) tab:

enter image description here

It looks like I've missed something in configuration. Any help will be appreciated.

0

There are 0 answers