Skip to content

Follow-up to #6384/#6453: the GraphQL introspection dispatch still ignores field aliases at five sites, so an aliased __type/__schema query answers wrongly #7036

Closed

Description

@ruispereira

Summary

The #6384 fix taught the query path to resolve a GraphQL field alias, and #6453 swept the top-level dispatch. The introspection dispatch was not swept: five sites still read selection.getField() only and never fall back to getFieldWithAlias(), so an aliased introspection query returns wrong data or a misleading parse error.

Found while re-validating #6384 against main.

Where (HEAD c50338bd8)

The pattern the fix established - graphql/src/main/java/com/arcadedb/graphql/schema/GraphQLSchema.java:407-408:

final Field field = selection.getField();
final FieldWithAlias aliasField = selection.getFieldWithAlias();

getFieldWithAlias occurs twice in the whole file. The five introspection sites all use the bare form:

:456  final Field field    = selection.getField();     // executeIntrospectionSchema
:480  final Field field    = selection.getField();     // executeIntrospectionType
:516  final Field field    = selection.getField();     // buildTypeList
:579  final Field subField = sub.getField();           // buildGraphQLTypeResult
:611  final Field subField = sub.getField();           // buildDatabaseTypeResult

Repro

Three distinct wrong outcomes, all from writing an alias:

{ t: __type(name: "Book") { name } }

executeQuery correctly resolves __type through the alias (:129-130) and dispatches, then field == null at :480, typeName stays null, and :487 throws CommandParsingException("__type query requires a 'name' argument") - for a query that supplied one.

{ s: __schema { queryType { name } } }

selectionSet resolves to null at :456, so the result is an object with no properties instead of the introspection data.

{ __type(name: "Book") { f: fields { name } } }

:579/:611 match sub-selections on sub.getName(), which is the alias when one is written, so fields is silently omitted.

Aliased introspection is not exotic - it is what a client does when it needs two __type lookups in one document, and Apollo-style tooling aliases by habit.

Note on severity vs the original issue

Every one of the five sites is null-guarded, so there is no NPE and no 500 - the symptom is a wrong result or a misleading error, not the crash #6384 was titled for. That is why this is a follow-up rather than a reopen.

Also worth recording: introspection predates the fix (added in ca750dec3, an ancestor of 915cdaf9b), so these are pre-existing siblings the sweep missed rather than newer code that regressed.

Suggested fix

At each of the five sites, resolve the field the way :407-421 already does - field != null ? field : selection.getFieldWithAlias() for both the arguments and the selection set - and compare sub-selection names against the aliased-away field name rather than Selection.getName(). Given the fix already has regression tests for the query path (Issue6384FieldAliasTest, Issue6453TopLevelQueryAliasTest), the natural addition is an aliased-introspection case alongside them.

Scope / confidence

High that the five sites lack the fallback (counted and quoted above). Medium on impact, since it depends on a client writing an alias on an introspection field.

Activity

  1. added
    graphql
    on Sep 2, 2026
  2. added this to the 26.9.1 milestone on Sep 2, 2026
  3. added
    in progress
    on Sep 3, 2026
  4. self-assigned this
    on Sep 3, 2026
  5. added a commit that references this issue on Sep 3, 2026
  6. lvca commented on Sep 3, 2026

    @lvca
    Member

    Fixed in #7091 (26.9.1).

    Aliased introspection queries (t: __type(name: "Book"), s: __schema { ... }, f: fields { ... }) now resolve the real field's arguments and selection set. Rather than patching the five sites, the resolution of a plain or aliased selection now lives in one place used by every consumer, so the query and introspection paths cannot drift apart again. Aliased sub-selections are returned under the alias, as the GraphQL spec prescribes.

    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  7. removed
    in progress
    on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggraphql

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions