@zenstackhq/language 3.0.0-beta.30 → 3.0.0-beta.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6615,13 +6615,22 @@ var DataSourceValidator = class {
6615
6615
  accept("error", '"schemas" must be an array of string literals', {
6616
6616
  node: schemasField
6617
6617
  });
6618
- } else if (
6619
- // validate `defaultSchema` is included in `schemas`
6620
- defaultSchemaValue && !schemasValue.items.some((e) => getStringLiteral(e) === defaultSchemaValue)
6621
- ) {
6622
- accept("error", `"${defaultSchemaValue}" must be included in the "schemas" array`, {
6623
- node: schemasField
6624
- });
6618
+ } else {
6619
+ const schemasArray = schemasValue.items.map((e) => getStringLiteral(e));
6620
+ if (defaultSchemaValue) {
6621
+ if (!schemasArray.includes(defaultSchemaValue)) {
6622
+ accept("error", `"${defaultSchemaValue}" must be included in the "schemas" array`, {
6623
+ node: schemasField
6624
+ });
6625
+ }
6626
+ } else {
6627
+ const hasImplicitPublicSchema = ds.$container.declarations.some((d) => (isDataModel(d) || isEnum(d)) && !d.attributes.some((a) => a.decl.$refText === "@@schema"));
6628
+ if (hasImplicitPublicSchema && !schemasArray.includes("public")) {
6629
+ accept("error", `"public" must be included in the "schemas" array`, {
6630
+ node: schemasField
6631
+ });
6632
+ }
6633
+ }
6625
6634
  }
6626
6635
  }
6627
6636
  }