@shaclmate/compiler 4.0.43 → 4.0.44

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.
@@ -226,6 +226,7 @@ ${joinCode(staticModuleDeclarations
226
226
  return jsTypes;
227
227
  }
228
228
  get jsonSchemaFunctionDeclaration() {
229
+ let expression = this.jsonSchemaExpression;
229
230
  const meta = {
230
231
  // id: this.name,
231
232
  };
@@ -235,7 +236,10 @@ ${joinCode(staticModuleDeclarations
235
236
  this.label.ifJust((label) => {
236
237
  meta["title"] = label;
237
238
  });
238
- return code `export const schema = () => ${this.jsonSchemaExpression}.meta(${meta});`;
239
+ if (Object.keys(meta).length > 0) {
240
+ expression = code `${expression}.meta(${meta})`;
241
+ }
242
+ return code `export const schema = () => ${expression};`;
239
243
  }
240
244
  get jsonTypeAliasDeclaration() {
241
245
  return code `export type Json = ${this.jsonTypeLiteral.expression}`;
@@ -3,6 +3,8 @@ export function ObjectType_jsonSchemaExpression() {
3
3
  const properties = this.properties
4
4
  .flatMap((property) => property.jsonSchema.toList())
5
5
  .map(({ key, schema }) => code `"${key}": ${schema}`);
6
+ // ${this.properties.every((property) => !property.mutable) ? `.readonly()` : ""}
7
+ let expression = code `${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}})`;
6
8
  const meta = {
7
9
  // id: this.name,
8
10
  };
@@ -12,7 +14,9 @@ export function ObjectType_jsonSchemaExpression() {
12
14
  this.label.ifJust((label) => {
13
15
  meta["title"] = label;
14
16
  });
15
- // ${this.properties.every((property) => !property.mutable) ? `.readonly()` : ""}
16
- return code `${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta})`;
17
+ if (Object.keys(meta).length > 0) {
18
+ expression = code `${expression}.meta(${meta})`;
19
+ }
20
+ return expression;
17
21
  }
18
22
  //# sourceMappingURL=ObjectType_jsonSchemaExpression.js.map
@@ -95,7 +95,9 @@ export class ShaclProperty extends AbstractProperty {
95
95
  this.label.ifJust((label) => {
96
96
  meta["title"] = label;
97
97
  });
98
- schema = code `${schema}.meta(${meta})`;
98
+ if (Object.keys(meta).length > 0) {
99
+ schema = code `${schema}.meta(${meta})`;
100
+ }
99
101
  return Maybe.of({
100
102
  key: this.name,
101
103
  schema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.43",
3
+ "@shaclmate/shacl-ast": "4.0.44",
4
4
  "@rdfjs/dataset": "~2.0.2",
5
5
  "@rdfjs/prefix-map": "~0.1.2",
6
6
  "@rdfjs/term-map": "~2.0.2",
@@ -66,5 +66,5 @@
66
66
  },
67
67
  "type": "module",
68
68
  "types": "./dist/index.d.ts",
69
- "version": "4.0.43"
69
+ "version": "4.0.44"
70
70
  }