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

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.cjs CHANGED
@@ -6651,13 +6651,22 @@ var DataSourceValidator = class {
6651
6651
  accept("error", '"schemas" must be an array of string literals', {
6652
6652
  node: schemasField
6653
6653
  });
6654
- } else if (
6655
- // validate `defaultSchema` is included in `schemas`
6656
- defaultSchemaValue && !schemasValue.items.some((e) => getStringLiteral(e) === defaultSchemaValue)
6657
- ) {
6658
- accept("error", `"${defaultSchemaValue}" must be included in the "schemas" array`, {
6659
- node: schemasField
6660
- });
6654
+ } else {
6655
+ const schemasArray = schemasValue.items.map((e) => getStringLiteral(e));
6656
+ if (defaultSchemaValue) {
6657
+ if (!schemasArray.includes(defaultSchemaValue)) {
6658
+ accept("error", `"${defaultSchemaValue}" must be included in the "schemas" array`, {
6659
+ node: schemasField
6660
+ });
6661
+ }
6662
+ } else {
6663
+ const hasImplicitPublicSchema = ds.$container.declarations.some((d) => (isDataModel(d) || isEnum(d)) && !d.attributes.some((a) => a.decl.$refText === "@@schema"));
6664
+ if (hasImplicitPublicSchema && !schemasArray.includes("public")) {
6665
+ accept("error", `"public" must be included in the "schemas" array`, {
6666
+ node: schemasField
6667
+ });
6668
+ }
6669
+ }
6661
6670
  }
6662
6671
  }
6663
6672
  }