Skip to content

Conversation

@scotttrinh
Copy link
Collaborator

For some reason, when selected a json typed link property, the internal with binding of the shape was being skipped, so it would generate incorrect EdgeQL with a missing with binding.

Correct:

    WITH
      __scope_0_defaultMovie := DETACHED default::Movie
    SELECT __scope_0_defaultMovie {
      id,
      profile := (
        WITH
          __scope_1_defaultProfile := __scope_0_defaultMovie.profile
        SELECT __scope_1_defaultProfile {
          d
        }
      ),
      characters := (
        WITH
          __scope_2_defaultPerson := (
            SELECT __scope_0_defaultMovie.characters {
              __linkprop_character_name := __scope_0_defaultMovie.characters@character_name,
              __linkprop_meta := __scope_0_defaultMovie.characters@meta
            }
          )
        SELECT __scope_2_defaultPerson {
          name,
          single @character_name := __scope_2_defaultPerson.__linkprop_character_name,
          single @meta := __scope_2_defaultPerson.__linkprop_meta
        }
      )
    }

Incorrect:

    WITH
      __scope_0_defaultMovie := DETACHED default::Movie
    SELECT __scope_0_defaultMovie {
      id,
      profile := (
        WITH
          __scope_1_defaultProfile := __scope_0_defaultMovie.profile
        SELECT __scope_1_defaultProfile {
          d
        }
      ),
      characters := (
        WITH
          __scope_2_defaultPerson := (
            SELECT __scope_0_defaultMovie.characters {
              __linkprop_character_name := __scope_0_defaultMovie.characters@character_name
            }
          )
        SELECT __scope_2_defaultPerson {
          name,
          single @character_name := __scope_2_defaultPerson.__linkprop_character_name,
          single @meta := __scope_2_defaultPerson.__linkprop_meta
        }
      )
    }

The failure case is selecting a `json` link property when selecting a
link. Also added a `json` property, and a nested select of a `json`
property even though those don't seem to trigger this failure.
TODO: why does this fix it? Maybe it's being erroneously marked as
scoped-from in this case?
@scotttrinh scotttrinh requested a review from jaclarke October 7, 2025 19:27
@scotttrinh scotttrinh marked this pull request as ready for review October 16, 2025 14:52
@scotttrinh scotttrinh merged commit 793ff6a into master Oct 16, 2025
8 of 9 checks passed
@scotttrinh scotttrinh deleted the fix-json-linkprops branch October 16, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants