Skip to content

Commit 03bc26d

Browse files
author
Marc Walker
committed
Fix: theta in vehicleTypeNodeProperties is not required
Change schema and generated models. Versions: + Python: 1.0.0.5 + C#: 1.0.0.2 + TypeScript: 1.0.0-4
1 parent d1aa90f commit 03bc26d

13 files changed

+37
-22
lines changed

config/csharp.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"buildCommand": "dotnet pack",
1515
"publish": {
1616
"packageName": "Vdma.Lif",
17-
"packageVersion": "1.0.0.1",
17+
"packageVersion": "1.0.0.2",
1818
"packageDirectory": "Vdma.Lif/bin/Release"
1919
}
2020
}

config/python.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"buildCommand": "python -m build",
1212
"publish": {
1313
"packageName": "vdma_lif",
14-
"packageVersion": "1.0.0.4",
14+
"packageVersion": "1.0.0.5",
1515
"packageDirectory": "dist"
1616
}
1717
}

examples/example.lif.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@
6868
},
6969
"vehicleTypeNodeProperties": [
7070
{
71-
"vehicleTypeId": "vehicle-001",
72-
"theta": 45.0
71+
"vehicleTypeId": "vehicle-002"
7372
}
7473
]
7574
}

schema/lif-schema.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@
156156
}
157157
},
158158
"required": [
159-
"vehicleTypeId",
160-
"theta"
159+
"vehicleTypeId"
161160
]
162161
}
163162
}

src/csharp/Vdma.Lif/LifModels.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ public partial class VehicleTypeNodeProperty
350350
/// Absolute orientation of the vehicle on the node in reference to the global origin’s
351351
/// rotation. Range: [-Pi ... Pi]
352352
/// </summary>
353+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
353354
[JsonPropertyName("theta")]
354-
public double Theta { get; set; }
355+
public double? Theta { get; set; }
355356

356357
/// <summary>
357358
/// Identifier for the vehicle type.

src/csharp/Vdma.Lif/Vdma.Lif.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<PackageId>Vdma.Lif</PackageId>
8-
<Version>1.0.0.1</Version>
8+
<Version>1.0.0.2</Version>
99
<Authors>Marc Walker</Authors>
1010
<Company>Continua Systems GmbH</Company>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>

src/python/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "vdma-lif"
9-
version = "1.0.0.4"
9+
version = "1.0.0.5"
1010
description = "JSON parsers and models for the VDMA - LIF (Layout Interchange Format), which is used for defining track layouts and exchanging information between the integrator of driverless transport vehicles and a third-party master control system."
1111
readme = "README.md"
1212
authors = [{ name = "Continua Systems GmbH", email = "info@continua.systems" }]

src/python/vdma_lif/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.0.3"
1+
__version__ = "1.0.0.5"

src/python/vdma_lif/models.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -374,31 +374,33 @@ def to_dict(self) -> dict:
374374

375375
@dataclass
376376
class VehicleTypeNodeProperty:
377-
theta: float
378-
"""Absolute orientation of the vehicle on the node in reference to the global origin’s
379-
rotation. Range: [-Pi ... Pi]
380-
"""
381377
vehicle_type_id: str
382378
"""Identifier for the vehicle type."""
383379

384380
actions: Optional[List[Action]] = None
385381
"""List of actions that the vehicle can perform at the node. *Optional*."""
386382

383+
theta: Optional[float] = None
384+
"""Absolute orientation of the vehicle on the node in reference to the global origin’s
385+
rotation. Range: [-Pi ... Pi]
386+
"""
387+
387388
@staticmethod
388389
def from_dict(obj: Any) -> 'VehicleTypeNodeProperty':
389390
assert isinstance(obj, dict)
390-
theta = from_float(obj.get("theta"))
391391
vehicle_type_id = from_str(obj.get("vehicleTypeId"))
392392
actions = from_union([lambda x: from_list(Action.from_dict, x), from_none], obj.get("actions"))
393-
return VehicleTypeNodeProperty(theta, vehicle_type_id, actions)
393+
theta = from_union([from_float, from_none], obj.get("theta"))
394+
return VehicleTypeNodeProperty(vehicle_type_id, actions, theta)
394395

395396
def to_dict(self) -> dict:
396397
result: dict = {}
397-
result["theta"] = to_float(self.theta)
398398
result["vehicleTypeId"] = from_str(self.vehicle_type_id)
399399
if self.actions is not None:
400400
result["actions"] = from_union([lambda x: from_list(
401401
lambda x: to_class(Action, x), x), from_none], self.actions)
402+
if self.theta is not None:
403+
result["theta"] = from_union([to_float, from_none], self.theta)
402404
return result
403405

404406

src/typescript/package.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
{
22
"name": "vdma-lif",
3-
"version": "1.0.0-1",
3+
"version": "1.0.0-4",
44
"description": "JSON parsers and models for the VDMA - LIF (Layout Interchange Format), which is used for defining track layouts and exchanging information between the integrator of driverless transport vehicles and a third-party master control system.",
5-
"main": "index.js",
5+
"main": "dist/index.js",
66
"types": "index.d.ts",
7+
"module": "dist/index.js",
8+
"exports": {
9+
".": {
10+
"import": "./dist/index.js",
11+
"require": "./dist/index.js"
12+
}
13+
},
14+
"files": [
15+
"dist/",
16+
"README.md"
17+
],
718
"prepublish": "tsc",
819
"scripts": {
920
"build": "tsc",

src/typescript/src/lifModels.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export interface VehicleTypeNodeProperty {
239239
* Absolute orientation of the vehicle on the node in reference to the global origin’s
240240
* rotation. Range: [-Pi ... Pi]
241241
*/
242-
theta: number;
242+
theta?: number;
243243
/**
244244
* Identifier for the vehicle type.
245245
*/
@@ -682,7 +682,7 @@ const typeMap: any = {
682682
VehicleTypeNodeProperty: o(
683683
[
684684
{ json: "actions", js: "actions", typ: u(undefined, a(r("Action"))) },
685-
{ json: "theta", js: "theta", typ: 3.14 },
685+
{ json: "theta", js: "theta", typ: u(undefined, 3.14) },
686686
{ json: "vehicleTypeId", js: "vehicleTypeId", typ: "" },
687687
],
688688
"any",

src/typescript/src/lifParser.spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ describe("LIFParser", () => {
6262
expect(action1.actionParameters![0].key).to.equal("speed");
6363
expect(action1.actionParameters![0].value).to.equal("fast");
6464

65+
const vehicleType2 = node1.vehicleTypeNodeProperties[1];
66+
expect(vehicleType2.vehicleTypeId).to.equal("vehicle-002");
67+
6568
// Layout Edges
6669
const edge1 = layout1.edges[0];
6770
expect(edge1.edgeId).to.equal("edge-001");

src/typescript/src/lifParser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from "fs";
2-
import { Convert, LIFLayoutCollection } from "./lifModels";
2+
import { Convert, type LIFLayoutCollection } from "./lifModels";
33

44
export class LIFParser {
55
static fromJson(jsonData: string): LIFLayoutCollection | null {

0 commit comments

Comments
 (0)