Skip to content

[Feature Request] Multiple entry zmodels in VS Code extension #1532

Open
@platon-ivanov

Description

@platon-ivanov

Is your feature request related to a problem? Please describe.
Currently using a structure with multiple entry zmodel schemas in different directories with their own User models or models with @@auth flags only respects one of the auth models in the VS Code extension.

- dbs
  - db1
    - schema.zmodel
  - db2
    - schema.zmodel
model User {
  @@allow('read', auth() == this) // works fine in `db1` directory. "incompatible operand types" when in `db2` directory.
}

Describe the solution you'd like
As @jiashengguo pointed out, a configuration setting could be introduced to support multiple schemas:

I think it's related to how the VSCode plugin works. From VSCode point of view, there is no entry schema as in CLI, so it just loads all the ZModel file could find in the project and try to compile them together. That's why you will see the error because there are two User models now.

I think in order to support multiple schema set in the same project, we probably need to introduce some configuration setting like

{
  "zmodelEntries": ["**/dbs/db1/schema.zmodel",  "**/dbs/db2/schema.zmodel"]  
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions