@@ -39,9 +39,12 @@ public record UpmPackageManifest
3939 [ JsonPropertyName ( "changelogUrl" ) ]
4040 [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
4141 public Uri ? ChangelogUrl { get ; set ; }
42+ /// <remarks>
43+ /// Some packages incorrectly use version ranges in the <c>dependencies</c> field, which is not supported by Unity Package Manager. But we support it here for compatibility.
44+ /// </remarks>
4245 [ JsonPropertyName ( "dependencies" ) ]
4346 [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
44- public Dictionary < string , SemanticVersion > Dependencies { get ; set ; } = new ( ) ;
47+ public Dictionary < string , SemanticVersionRange > Dependencies { get ; set ; } = new ( ) ;
4548 [ JsonPropertyName ( "documentationUrl" ) ]
4649 [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
4750 public Uri ? DocumentationUrl { get ; set ; }
@@ -71,69 +74,5 @@ public record UpmPackageManifest
7174 public string ? UnityRelease { get ; set ; }
7275
7376 [ JsonExtensionData ]
74-
7577 public Dictionary < string , JsonElement > ? AdditionalProperties { get ; set ; }
7678}
77-
78- public partial record VpmPackageManifest : UpmPackageManifest
79- {
80-
81- [ JsonPropertyName ( "vpmDependencies" ) ]
82- [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
83- public Dictionary < string , SemanticVersionRange > ? VpmDependencies { get ; set ; }
84- [ JsonPropertyName ( "url" ) ]
85- [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
86- public Uri ? Url { get ; set ; }
87-
88- [ JsonPropertyName ( "zipSHA256" ) ]
89- [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
90- public string ? ZipSha256 { get ; set ; }
91- }
92-
93- public record PackageSample
94- {
95- [ JsonPropertyName ( "displayName" ) ]
96- [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
97- public string ? DisplayName { get ; set ; }
98- [ JsonPropertyName ( "description" ) ]
99- [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
100- public string ? Description { get ; set ; }
101- [ JsonPropertyName ( "path" ) ]
102- [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
103- public string ? Path { get ; set ; }
104- }
105-
106- public record VpmRepositoryManifest
107- {
108- [ JsonPropertyName ( "name" ) ]
109- public required string Name { get ; set ; }
110- [ JsonPropertyName ( "id" ) ]
111- public required string Id { get ; set ; }
112- [ JsonPropertyName ( "author" ) ]
113- [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
114- public string ? Author { get ; set ; }
115- [ JsonPropertyName ( "url" ) ]
116- public required Uri Url { get ; set ; }
117-
118- [ JsonPropertyName ( "packages" ) ]
119- public required Dictionary < string , VpmPackageVersions > Packages { get ; set ; }
120- }
121-
122- public record VpmPackageVersions
123- {
124- [ JsonPropertyName ( "versions" ) ]
125- public required Dictionary < SemanticVersion , VpmPackageManifest > Versions { get ; set ; } = new ( ) ;
126- }
127-
128- public static class Json
129- {
130- public static JsonSerializerOptions JsonSerializerOptions { get ; } = new ( )
131- {
132- Converters =
133- {
134- new SemanticVersionJsonConverter ( ) ,
135- new SemanticVersionRangeJsonConverter ( ) ,
136- } ,
137- DefaultIgnoreCondition = JsonIgnoreCondition . WhenWritingNull ,
138- } ;
139- }
0 commit comments