Skip to content
This repository was archived by the owner on Mar 22, 2026. It is now read-only.

Commit 9d22a04

Browse files
committed
修复 modrinth 上传脚本对没有版本的依赖处理不正确的问题
1 parent 859442e commit 9d22a04

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

rule/modrinth_uploader/ModrinthUploadData.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package top.fifthlight.fabazel.modrinthuploader;
22

3+
import com.fasterxml.jackson.annotation.JsonInclude;
34
import com.fasterxml.jackson.annotation.JsonProperty;
45
import com.fasterxml.jackson.annotation.JsonValue;
56

@@ -39,7 +40,8 @@ public record ModrinthUploadData(
3940
Objects.requireNonNull(primaryFile, "primaryFile cannot be null");
4041
}
4142

42-
public record Dependency(@JsonProperty("project_id") String projectId, @JsonProperty("version_id") String versionId,
43+
public record Dependency(@JsonProperty("project_id") String projectId,
44+
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("version_id") String versionId,
4345
@JsonProperty("dependency_type") Type type) {
4446
public Dependency {
4547
Objects.requireNonNull(projectId, "projectId cannot be null");

rule/modrinth_uploader/ModrinthUploader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static void main(String[] args) throws IOException, InterruptedException
7878
}
7979
}
8080

81-
if (inDependencyBlock && tempDependencyProjectId != null && tempDependencyVersionId != null && tempDependencyType != null) {
81+
if (inDependencyBlock && tempDependencyProjectId != null && tempDependencyType != null) {
8282
dependencies.add(new ModrinthUploadData.Dependency(tempDependencyProjectId, tempDependencyVersionId, tempDependencyType));
8383
}
8484

0 commit comments

Comments
 (0)