edgedb-js
                                
                                 edgedb-js copied to clipboard
                                
                                    edgedb-js copied to clipboard
                            
                            
                            
                        Broken typescript for schemas using nested modules with undefined parent module
Describe the bug
The @gel/generate edgeql-js tool generates incomplete models for gel schemas using nested modules where a child module has no valid parent, for clarity:
- myModule
- myModule::config
- myModule::config::option
- myModule::nestedModule::anotherNestedModule <-- has no "parent" module named "nestedModule"
Reproduction
# ./dbschema/default.gel
module company {
  type Company {
    required property name -> str;
    multi link employees -> company::Employee;
  }
  type Employee {
    required property name -> str;
    required link company -> company::Company;
    required link people -> company::employee::people::People;
  }
}
module company::employee::people {
  type People {
    required property first_name -> str;
    required property last_name -> str;
    multi link employment -> company::Employee;
  }
}
// ./index.ts
import e from './dbschema/edgeql-js';
const getEmployees = () =>
  e.select(
    e.company.Employee,
    () => e.company.Employee['*'],
  );
/*
 * e.company.employee is defined as 'any'
 * need to import person module with absolute path
 * import person from './dbschema/edgeql-js/modules/company/employee/person';
 * 
 * const getPeople = () =>
 *   e.select(
 *    person.Person,
 *    () => person.Person['*'],
 *  )
 */
Expected behavior
@gel/generate edgeql-js should either throw error that the defined schema is incorrect, or create an abstract module that forward the child module correctly to ensure nested modules are accessible through the undefined, but specified, parents.
File tree
./dbschema/edgeql-js/modules/company.ts
Versions (please complete the following information):
- OS: Windows 11 x64
- EdgeDB version (e.g. 2.0): Gel 6.5+bd2126b (repl 7.2.0+70c7e2d)
- EdgeDB CLI version (e.g. 2.0): Gel CLI 7.2.0+70c7e2d
- edgedb-jsversion (e.g.- 0.20.10;): @gel/generate v0.6.2
- Node/Deno version: Node v22.14.0
Additional context Please let me know if further clarification is needed, glad to help out Discord thread: https://discord.com/channels/841451783728529451/849374705210490900/1366261219857793097