@snowplow/snowtype-core 0.1.0 → 0.1.1

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.
@@ -22,6 +22,7 @@ class SnowtypeKotlinRenderer extends Kotlin_1.KotlinXRenderer {
22
22
  type: this.sourcelikeToString(this.kotlinType(p.type)),
23
23
  isOptional: p.isOptional,
24
24
  isNullable: this.isNullable(p),
25
+ isNullableOrOptional: p.isOptional || this.isNullable(p),
25
26
  isArrayOfEnums: arrayDetails && arrayDetails.get("array").includes("enum"),
26
27
  isArrayOfObjects: arrayDetails && arrayDetails.get("array").includes("class"),
27
28
  isEnum: this.isEnum(p),
@@ -51,7 +51,7 @@ module.exports = { "1": function (container, depth0, helpers, partials, data) {
51
51
  }
52
52
  return undefined;
53
53
  };
54
- return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), (depth0 != null ? lookupProperty(depth0, "isNullable") : depth0), { "name": "if", "hash": {}, "fn": container.program(7, data, 0, blockParams, depths), "inverse": container.program(23, data, 0, blockParams, depths), "data": data, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 46, "column": 7 } } })) != null ? stack1 : "");
54
+ return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), (depth0 != null ? lookupProperty(depth0, "isNullableOrOptional") : depth0), { "name": "if", "hash": {}, "fn": container.program(7, data, 0, blockParams, depths), "inverse": container.program(23, data, 0, blockParams, depths), "data": data, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 46, "column": 7 } } })) != null ? stack1 : "");
55
55
  }, "7": function (container, depth0, helpers, partials, data, blockParams, depths) {
56
56
  var stack1, helper, alias1 = container.lambda, alias2 = container.escapeExpression, alias3 = depth0 != null ? depth0 : (container.nullContext || {}), alias4 = container.hooks.helperMissing, alias5 = "function", lookupProperty = container.lookupProperty || function (parent, propertyName) {
57
57
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -21,6 +21,7 @@ class SnowtypeSwiftRenderer extends quicktype_core_1.SwiftRenderer {
21
21
  type: this.sourcelikeToString(this.swiftPropertyType(p)),
22
22
  isOptional: p.isOptional,
23
23
  isNullable: this.isNullable(p),
24
+ isNullableOrOptional: p.isOptional || this.isNullable(p),
24
25
  isArrayOfEnums: arrayDetails && arrayDetails.get("array").includes("enum"),
25
26
  isArrayOfObjects: arrayDetails && arrayDetails.get("array").includes("class"),
26
27
  isEnum: this.isEnum(p),
@@ -62,6 +62,7 @@ export interface ClassDataRendererAttributes {
62
62
  type: string;
63
63
  isOptional: boolean;
64
64
  isNullable: boolean;
65
+ isNullableOrOptional: boolean;
65
66
  isArrayOfEnums?: boolean;
66
67
  isArrayOfObjects?: boolean;
67
68
  isEnum: boolean;
@@ -42,16 +42,18 @@ function createCodeGeneratorFromTemplate(supportedTemplate, nameModifiers) {
42
42
  }
43
43
  }, (e, enumName) => {
44
44
  const cases = [];
45
- const { typeName, description } = (0, renderer_helpers_1.extractRendererNames)(renderer, e, enumName, nameModifiers);
45
+ const { description } = (0, renderer_helpers_1.extractRendererNames)(renderer, e, enumName, nameModifiers);
46
46
  // @ts-expect-error Protected
47
47
  renderer.forEachEnumCase(e, "none", (name, jsonName) => {
48
48
  cases.push({
49
- name: typeName,
49
+ // @ts-expect-error Protected
50
+ name: renderer.sourcelikeToString(name),
50
51
  jsonName: jsonName,
51
52
  });
52
53
  });
53
54
  tags.enums.push({
54
- name: typeName,
55
+ // @ts-expect-error Protected
56
+ name: renderer.sourcelikeToString(enumName),
55
57
  description,
56
58
  cases,
57
59
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowplow/snowtype-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A code generator for faster and type-safe Snowplow tracking code",
5
5
  "author": "Peter Perlepes <peter@snowplowanalytics.com>",
6
6
  "homepage": "https://snowplow.io/",