From 2766ee036332852525312980ab0a2dce4de448a6 Mon Sep 17 00:00:00 2001 From: Konstantin Chukharev Date: Fri, 7 Jun 2024 12:01:11 +0300 Subject: [PATCH] Update ArkFile fields --- .../org/jacodb/panda/dynamic/ark/dto/Model.kt | 6 +++--- .../jacodb/panda/dynamic/ark/dto/convert.kt | 4 ++-- .../jacodb/panda/dynamic/ark/model/ArkFile.kt | 4 ++-- .../src/main/resources/arkfile-schema.json | 20 ++++++++++++------- .../src/test/resources/basic.ts.json | 3 --- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/Model.kt b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/Model.kt index 82f3ee73b..dd73ec235 100644 --- a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/Model.kt +++ b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/Model.kt @@ -27,9 +27,9 @@ import java.io.InputStream @Serializable data class ArkFileDto( val name: String, - val absoluteFilePath: String, - val projectDir: String, - val projectName: String, + val absoluteFilePath: String? = null, + val projectDir: String? = null, + val projectName: String? = null, val namespaces: List, val classes: List, val importInfos: List, diff --git a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/convert.kt b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/convert.kt index 05db013a5..bb1e7800c 100644 --- a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/convert.kt +++ b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/convert.kt @@ -445,9 +445,9 @@ fun convertToArkClass(clazz: ClassDto): ArkClass { fun convertToArkFile(file: ArkFileDto): ArkFile { val classes = file.classes.map { convertToArkClass(it) } return ArkFile( + name = file.name, path = file.absoluteFilePath, - projectName = file.projectName, - classes = classes + classes = classes, ) } diff --git a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/model/ArkFile.kt b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/model/ArkFile.kt index c855d82d2..dbe051ce3 100644 --- a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/model/ArkFile.kt +++ b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/model/ArkFile.kt @@ -17,7 +17,7 @@ package org.jacodb.panda.dynamic.ark.model class ArkFile( - val path: String, - val projectName: String, + val name: String, + val path: String? = null, val classes: List, ) diff --git a/jacodb-panda-dynamic/src/main/resources/arkfile-schema.json b/jacodb-panda-dynamic/src/main/resources/arkfile-schema.json index 2d8b9a82e..e78dcbabc 100644 --- a/jacodb-panda-dynamic/src/main/resources/arkfile-schema.json +++ b/jacodb-panda-dynamic/src/main/resources/arkfile-schema.json @@ -1349,7 +1349,10 @@ }, "properties": { "absoluteFilePath": { - "type": "string" + "type": [ + "null", + "string" + ] }, "classes": { "items": { @@ -1379,21 +1382,24 @@ "type": "array" }, "projectDir": { - "type": "string" + "type": [ + "null", + "string" + ] }, "projectName": { - "type": "string" + "type": [ + "null", + "string" + ] } }, "required": [ - "absoluteFilePath", "classes", "exportInfos", "importInfos", "name", - "namespaces", - "projectDir", - "projectName" + "namespaces" ], "type": "object" } diff --git a/jacodb-panda-dynamic/src/test/resources/basic.ts.json b/jacodb-panda-dynamic/src/test/resources/basic.ts.json index 2e384bf7d..1473ac2ff 100644 --- a/jacodb-panda-dynamic/src/test/resources/basic.ts.json +++ b/jacodb-panda-dynamic/src/test/resources/basic.ts.json @@ -1,8 +1,5 @@ { "name": "basic.ts", - "absoluteFilePath": "/home/sapphiron/dev/ark/arkanalyzer/tests/resources/save/basic.ts", - "projectDir": "/home/sapphiron/dev/ark/arkanalyzer/tests/resources/save", - "projectName": "save", "namespaces": [], "classes": [ {