Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we have complex cue schemas that extends from other cue files, sometimes the extends is missing. Our current loop tries to extract the value when it has a
SelectorOP
and sometimes, the dependency that we are looking for is deeper.In a simple case, the structs that we have are like:
[.] (struct) ├── (struct) ├── "OurExtend" └── [ref:OurExtend] └── (struct) @cuetsy(kind="interface")
So dereferencing it, we can extract the value.
But for complex schemas, we can have something like:
[.] (struct) ├── [] (struct) │ └── [ref:composableKinds.DataQuery.lineage.schemas[0]] │ └── [&] (struct) │ ├── (struct) │ ├── [.] (struct) │ │ ├── (struct) │ │ ├── "#SchemaDef"... │ │ └── [ref:#SchemaDef] │ │ └── (struct) │ └── (struct) ├── "schema" └── [ref:composableKinds.DataQuery.lineage.schemas[0].schema] └── [&] (struct) ├── [&] (struct) │ ├── [.] (struct) │ │ ├── (struct) │ │ ├── "OurExtend" │ │ └── [ref:OurExtend] │ │ └── (struct) @cuetsy(kind="interface") │ └── (struct) └── _
And you can see that our desired extend is inside the dereference. In that case we need to iterate this deference until we find have a schema without the
TopKind
.This is important because its our stop condition. If we don't check this
TopKind
, we could continue iterating this schema and we could retrieve extends (if any) from our desired extend 😅. (For example, ifOurExtend
extends fromFoo
andBar
, we are going to retrieve these values instead ofOurExtend
)