Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not expose unsupported queries in the GraphQL schema. #16134

Merged
merged 6 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public async Task BuildAsync(ISchema schema)

var fieldTypeName = querySchema["fieldTypeName"]?.ToString() ?? query.Name;

if (type.StartsWith("ContentItem/", StringComparison.OrdinalIgnoreCase))
if (query.ReturnDocuments && type.StartsWith("ContentItem/", StringComparison.OrdinalIgnoreCase))
{
var contentType = type.Remove(0, 12);
fieldType = BuildContentTypeFieldType(schema, contentType, query, fieldTypeName);
Expand All @@ -86,7 +86,7 @@ public async Task BuildAsync(ISchema schema)

private static FieldType BuildSchemaBasedFieldType(SqlQuery query, JsonNode querySchema, string fieldTypeName)
{
var properties = querySchema["properties"].AsObject();
var properties = querySchema["properties"]?.AsObject();
if (properties == null)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ public async Task BuildAsync(ISchema schema)

private static FieldType BuildSchemaBasedFieldType(ElasticQuery query, JsonNode querySchema, string fieldTypeName)
{
var properties = querySchema["properties"].AsObject();

var properties = querySchema["properties"]?.AsObject();
if (properties == null)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public async Task BuildAsync(ISchema schema)

private static FieldType BuildSchemaBasedFieldType(LuceneQuery query, JsonNode querySchema, string fieldTypeName)
{
var properties = querySchema["properties"].AsObject();
var properties = querySchema["properties"]?.AsObject();
if (properties == null)
{
return null;
Expand Down