Skip to content

Commit 9ab6300

Browse files
authored
Fix nullable handling and issue #295 (#296)
* update release note builde * fix nullables and routing
1 parent 6c81fe1 commit 9ab6300

29 files changed

+159
-165
lines changed

.github/changelog_configuration.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
"order": "ASC",
7272
"on_property": "mergedAt"
7373
},
74-
"template": "# 📦 Changelog\n\n#{{CHANGELOG}}\n\n#{{UNCATEGORIZED}}\n\n# Full Changelog\n[🔗 Release Diff](#{{RELEASE_DIFF}})\n\n# 👥 New Contributors\n\nMust be added manually.",
74+
"template": "# 📦 Changelog\n\n#{{CHANGELOG}}\n\n#{{UNCATEGORIZED}}\n\n# Full Changelog\n[🔗 Release Diff](#{{RELEASE_DIFF}})\n\n# 👥Contributors\n\n ",
7575
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in #{{URL}}",
76-
"empty_template": "No changes detected. See the [Changelog](CHANGELOG.md) for more information.",
76+
"empty_template": "No changes detected. See the [Changelog](CHANGELOG.md) or [Release Diff](#{{RELEASE_DIFF}}) for more information.",
7777
"label_extractor": [
7878
{
7979
"pattern": "(.*)",

src/IO.Swagger.Lib.V3/Controllers/AASXFileServerAPIApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public AASXFileServerAPIApiController(IAppLogger<AASXFileServerAPIApiController>
4545
_decoderService = decoderService ?? throw new ArgumentNullException(nameof(decoderService)); ;
4646
_fileService = fileService ?? throw new ArgumentNullException(nameof(fileService));
4747
_paginationService = paginationService ?? throw new ArgumentNullException(nameof(paginationService));
48-
_authorizationService = authorizationService ?? throw new ArgumentNullException(nameof(paginationService));
48+
_authorizationService = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
4949
}
5050
/// <summary>
5151
/// Deletes a specific AASX package from the server

src/IO.Swagger.Lib.V3/Controllers/AssetAdministrationShellRepositoryAPIApi.cs

-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ public virtual IActionResult DeleteThumbnailAasRepository([FromRoute] [Required]
334334
[SwaggerResponse(statusCode: 500, type: typeof(Result), description: "Internal Server Error")]
335335
[SwaggerResponse(statusCode: 0, type: typeof(Result), description: "Default error handling for unmentioned status codes")]
336336
// TODO (jtikekar, 2023-09-04): assetIds: string or specific asset id, and what about Base64Uel encoding
337-
//public virtual IActionResult GetAllAssetAdministrationShells([FromQuery] List<string> assetIds, [FromQuery] string idShort, [FromQuery] int? limit, [FromQuery] string cursor)
338337
public virtual IActionResult GetAllAssetAdministrationShells([FromQuery] List<SpecificAssetId>? assetIds, [FromQuery] string? idShort, [FromQuery] int? limit,
339338
[FromQuery] string? cursor)
340339
{

src/IO.Swagger.Lib.V3/Controllers/ConceptDescriptionRepositoryAPIApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public ConceptDescriptionRepositoryAPIApiController(IAppLogger<ConceptDescriptio
4848
_cdService = cdService ?? throw new ArgumentNullException(nameof(cdService));
4949
_jsonQueryDeserializer = jsonQueryDeserializer ?? throw new ArgumentNullException(nameof(jsonQueryDeserializer));
5050
_paginationService = paginationService ?? throw new ArgumentNullException(nameof(paginationService));
51-
_authorizationService = authorizationService ?? throw new ArgumentNullException(nameof(paginationService));
51+
_authorizationService = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
5252
}
5353

5454
/// <summary>

src/IO.Swagger.Lib.V3/Controllers/SubmodelRepositoryAPIApi.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public SubmodelRepositoryAPIApiController(IAppLogger<SubmodelRepositoryAPIApiCon
6666
_jsonQueryDeserializer = jsonQueryDeserializer ?? throw new ArgumentNullException(nameof(jsonQueryDeserializer));
6767
_mappingService = mappingService ?? throw new ArgumentNullException(nameof(mappingService));
6868
_pathModifierService = pathModifierService ?? throw new ArgumentNullException(nameof(pathModifierService));
69-
_levelExtentModifierService = levelExtentModifierService ?? throw new ArgumentNullException(nameof(pathModifierService));
70-
_paginationService = paginationService ?? throw new ArgumentNullException(nameof(pathModifierService));
69+
_levelExtentModifierService = levelExtentModifierService ?? throw new ArgumentNullException(nameof(levelExtentModifierService));
70+
_paginationService = paginationService ?? throw new ArgumentNullException(nameof(paginationService));
7171
_authorizationService = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
7272
}
7373

src/IO.Swagger.Lib.V3/Filters/BasePathFilter.cs

+9-7
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@ public BasePathFilter(string basePath)
3333
/// <param name="context">FilterContext</param>
3434
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
3535
{
36-
swaggerDoc.Servers.Add(new OpenApiServer() { Url = this.BasePath });
36+
swaggerDoc.Servers.Add(new OpenApiServer() {Url = BasePath});
3737

38-
var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(this.BasePath)).ToList();
38+
var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(BasePath)).ToList();
3939

4040
foreach (var path in pathsToModify)
4141
{
42-
if (path.Key.StartsWith(this.BasePath))
42+
if (!path.Key.StartsWith(BasePath))
4343
{
44-
string newKey = Regex.Replace(path.Key, $"^{this.BasePath}", string.Empty);
45-
swaggerDoc.Paths.Remove(path.Key);
46-
swaggerDoc.Paths.Add(newKey, path.Value);
44+
continue;
4745
}
46+
47+
var newKey = Regex.Replace(path.Key, $"^{BasePath}", string.Empty);
48+
swaggerDoc.Paths.Remove(path.Key);
49+
swaggerDoc.Paths.Add(newKey, path.Value);
4850
}
4951
}
5052
}
51-
}
53+
}

src/IO.Swagger.Lib.V3/Filters/GeneratePathParamsValidationFilter.cs

+4-10
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ public void Apply(OpenApiOperation operation, OperationFilterContext context)
3939
var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute));
4040
if (regexAttr != null)
4141
{
42-
string regex = (string)regexAttr.ConstructorArguments[0].Value;
43-
if (swaggerParam is OpenApiParameter)
44-
{
45-
((OpenApiParameter)swaggerParam).Schema.Pattern = regex;
46-
}
42+
var regex = (string)regexAttr.ConstructorArguments[0].Value;
43+
swaggerParam.Schema.Pattern = regex;
4744
}
4845

4946
// String Length [StringLength]
@@ -83,11 +80,8 @@ public void Apply(OpenApiOperation operation, OperationFilterContext context)
8380
var rangeMin = (int)(rangeAttr.ConstructorArguments[0].Value ?? 0);
8481
var rangeMax = (int)(rangeAttr.ConstructorArguments[1].Value ?? 1);
8582

86-
if (swaggerParam is OpenApiParameter)
87-
{
88-
((OpenApiParameter)swaggerParam).Schema.Minimum = rangeMin;
89-
((OpenApiParameter)swaggerParam).Schema.Maximum = rangeMax;
90-
}
83+
swaggerParam.Schema.Minimum = rangeMin;
84+
swaggerParam.Schema.Maximum = rangeMax;
9185
}
9286
}
9387
}

src/IO.Swagger.Lib.V3/Formatters/AasRequestFormatter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class AasRequestFormatter : InputFormatter
2222
{
2323
public AasRequestFormatter()
2424
{
25-
this.SupportedMediaTypes.Clear();
26-
this.SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json"));
25+
SupportedMediaTypes.Clear();
26+
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json"));
2727
}
2828

2929
public override bool CanRead(InputFormatterContext context)

src/IO.Swagger.Lib.V3/Formatters/AasResponseFormatter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class AasResponseFormatter : OutputFormatter
2222
{
2323
public AasResponseFormatter()
2424
{
25-
this.SupportedMediaTypes.Clear();
26-
this.SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json"));
25+
SupportedMediaTypes.Clear();
26+
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json"));
2727
}
2828
public static bool IsGenericListOfIClass(object o)
2929
{

src/IO.Swagger.Lib.V3/Models/BaseOperationResult.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ public bool Equals(BaseOperationResult? other)
8989
return
9090
(
9191
ExecutionState == other.ExecutionState ||
92-
ExecutionState != null &&
93-
ExecutionState.Equals(other.ExecutionState)
92+
(ExecutionState != null &&
93+
ExecutionState.Equals(other.ExecutionState))
9494
) &&
9595
(
9696
Success == other.Success ||
97-
Success != null &&
98-
Success.Equals(other.Success)
97+
(Success != null &&
98+
Success.Equals(other.Success))
9999
);
100100
}
101101

@@ -110,9 +110,9 @@ public override int GetHashCode()
110110
var hashCode = 41;
111111
// Suitable nullity checks etc, of course :)
112112
if (ExecutionState != null)
113-
hashCode = hashCode * 59 + ExecutionState.GetHashCode();
113+
hashCode = (hashCode * 59) + ExecutionState.GetHashCode();
114114
if (Success != null)
115-
hashCode = hashCode * 59 + Success.GetHashCode();
115+
hashCode = (hashCode * 59) + Success.GetHashCode();
116116
return hashCode;
117117
}
118118
}

src/IO.Swagger.Lib.V3/Models/Description.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ public bool Equals(Description? other)
168168
return
169169
(
170170
Profiles == other.Profiles ||
171-
Profiles != null &&
172-
Profiles.SequenceEqual(other.Profiles)
171+
(Profiles != null &&
172+
Profiles.SequenceEqual(other.Profiles))
173173
);
174174
}
175175

@@ -184,7 +184,7 @@ public override int GetHashCode()
184184
var hashCode = 41;
185185
// Suitable nullity checks etc, of course :)
186186
if (Profiles != null)
187-
hashCode = hashCode * 59 + Profiles.GetHashCode();
187+
hashCode = (hashCode * 59) + Profiles.GetHashCode();
188188
return hashCode;
189189
}
190190
}

src/IO.Swagger.Lib.V3/Models/GetPathItemsResult.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public bool Equals(GetPathItemsResult? other)
7373
return
7474
(
7575
Result == other.Result ||
76-
Result != null &&
77-
Result.SequenceEqual(other.Result)
76+
(Result != null &&
77+
Result.SequenceEqual(other.Result))
7878
);
7979
}
8080

@@ -89,7 +89,7 @@ public override int GetHashCode()
8989
var hashCode = 41;
9090
// Suitable nullity checks etc, of course :)
9191
if (Result != null)
92-
hashCode = hashCode * 59 + Result.GetHashCode();
92+
hashCode = (hashCode * 59) + Result.GetHashCode();
9393
return hashCode;
9494
}
9595
}

src/IO.Swagger.Lib.V3/Models/GetReferencesResult.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public bool Equals(GetReferencesResult? other)
7373
return
7474
(
7575
Result == other.Result ||
76-
Result != null &&
77-
Result.SequenceEqual(other.Result)
76+
(Result != null &&
77+
Result.SequenceEqual(other.Result))
7878
);
7979
}
8080

@@ -89,7 +89,7 @@ public override int GetHashCode()
8989
var hashCode = 41;
9090
// Suitable nullity checks etc, of course :)
9191
if (Result != null)
92-
hashCode = hashCode * 59 + Result.GetHashCode();
92+
hashCode = (hashCode * 59) + Result.GetHashCode();
9393
return hashCode;
9494
}
9595
}

src/IO.Swagger.Lib.V3/Models/GetSubmodelElementsResult.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public bool Equals(GetSubmodelElementsResult? other)
7373
return
7474
(
7575
Result == other.Result ||
76-
Result != null &&
77-
Result.SequenceEqual(other.Result)
76+
(Result != null &&
77+
Result.SequenceEqual(other.Result))
7878
);
7979
}
8080

@@ -89,7 +89,7 @@ public override int GetHashCode()
8989
var hashCode = 41;
9090
// Suitable nullity checks etc, of course :)
9191
if (Result != null)
92-
hashCode = hashCode * 59 + Result.GetHashCode();
92+
hashCode = (hashCode * 59) + Result.GetHashCode();
9393
return hashCode;
9494
}
9595
}

src/IO.Swagger.Lib.V3/Models/OperationRequest.cs

+16-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* The entire Repository Service Specification as part of Details of the Asset Administration Shell Part 2
55
*
66
* OpenAPI spec version: V3.0
7-
*
7+
*
88
* Generated by: https://github.com/swagger-api/swagger-codegen.git
99
*/
1010

@@ -103,23 +103,23 @@ public bool Equals(OperationRequest? other)
103103
return
104104
(
105105
InoutputArguments == other.InoutputArguments ||
106-
InoutputArguments != null &&
107-
InoutputArguments.SequenceEqual(other.InoutputArguments)
106+
(InoutputArguments != null &&
107+
InoutputArguments.SequenceEqual(other.InoutputArguments))
108108
) &&
109109
(
110110
InputArguments == other.InputArguments ||
111-
InputArguments != null &&
112-
InputArguments.SequenceEqual(other.InputArguments)
111+
(InputArguments != null &&
112+
InputArguments.SequenceEqual(other.InputArguments))
113113
) &&
114114
(
115115
RequestId == other.RequestId ||
116-
RequestId != null &&
117-
RequestId.Equals(other.RequestId)
116+
(RequestId != null &&
117+
RequestId.Equals(other.RequestId))
118118
) &&
119119
(
120120
Timeout == other.Timeout ||
121-
Timeout != null &&
122-
Timeout.Equals(other.Timeout)
121+
(Timeout != null &&
122+
Timeout.Equals(other.Timeout))
123123
);
124124
}
125125

@@ -134,18 +134,19 @@ public override int GetHashCode()
134134
var hashCode = 41;
135135
// Suitable nullity checks etc, of course :)
136136
if (InoutputArguments != null)
137-
hashCode = hashCode * 59 + InoutputArguments.GetHashCode();
137+
hashCode = (hashCode * 59) + InoutputArguments.GetHashCode();
138138
if (InputArguments != null)
139-
hashCode = hashCode * 59 + InputArguments.GetHashCode();
139+
hashCode = (hashCode * 59) + InputArguments.GetHashCode();
140140
if (RequestId != null)
141-
hashCode = hashCode * 59 + RequestId.GetHashCode();
141+
hashCode = (hashCode * 59) + RequestId.GetHashCode();
142142
if (Timeout != null)
143-
hashCode = hashCode * 59 + Timeout.GetHashCode();
143+
hashCode = hashCode * 0x3B + Timeout.GetHashCode();
144144
return hashCode;
145145
}
146146
}
147147

148148
#region Operators
149+
149150
#pragma warning disable 1591
150151

151152
public static bool operator ==(OperationRequest left, OperationRequest right)
@@ -159,6 +160,7 @@ public override int GetHashCode()
159160
}
160161

161162
#pragma warning restore 1591
163+
162164
#endregion Operators
163165
}
164-
}
166+
}

src/IO.Swagger.Lib.V3/Models/OperationResult.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -111,28 +111,28 @@ public bool Equals(OperationResult? other)
111111
return
112112
(
113113
ExecutionResult == other.ExecutionResult ||
114-
ExecutionResult != null &&
115-
ExecutionResult.Equals(other.ExecutionResult)
114+
(ExecutionResult != null &&
115+
ExecutionResult.Equals(other.ExecutionResult))
116116
) &&
117117
(
118118
ExecutionState == other.ExecutionState ||
119-
ExecutionState != null &&
120-
ExecutionState.Equals(other.ExecutionState)
119+
(ExecutionState != null &&
120+
ExecutionState.Equals(other.ExecutionState))
121121
) &&
122122
(
123123
InoutputArguments == other.InoutputArguments ||
124-
InoutputArguments != null &&
125-
InoutputArguments.SequenceEqual(other.InoutputArguments)
124+
(InoutputArguments != null &&
125+
InoutputArguments.SequenceEqual(other.InoutputArguments))
126126
) &&
127127
(
128128
OutputArguments == other.OutputArguments ||
129-
OutputArguments != null &&
130-
OutputArguments.SequenceEqual(other.OutputArguments)
129+
(OutputArguments != null &&
130+
OutputArguments.SequenceEqual(other.OutputArguments))
131131
) &&
132132
(
133133
RequestId == other.RequestId ||
134-
RequestId != null &&
135-
RequestId.Equals(other.RequestId)
134+
(RequestId != null &&
135+
RequestId.Equals(other.RequestId))
136136
);
137137
}
138138

@@ -147,15 +147,15 @@ public override int GetHashCode()
147147
var hashCode = 41;
148148
// Suitable nullity checks etc, of course :)
149149
if (ExecutionResult != null)
150-
hashCode = hashCode * 59 + ExecutionResult.GetHashCode();
150+
hashCode = (hashCode * 59) + ExecutionResult.GetHashCode();
151151
if (ExecutionState != null)
152-
hashCode = hashCode * 59 + ExecutionState.GetHashCode();
152+
hashCode = (hashCode * 59) + ExecutionState.GetHashCode();
153153
if (InoutputArguments != null)
154-
hashCode = hashCode * 59 + InoutputArguments.GetHashCode();
154+
hashCode = (hashCode * 59) + InoutputArguments.GetHashCode();
155155
if (OutputArguments != null)
156-
hashCode = hashCode * 59 + OutputArguments.GetHashCode();
156+
hashCode = (hashCode * 59) + OutputArguments.GetHashCode();
157157
if (RequestId != null)
158-
hashCode = hashCode * 59 + RequestId.GetHashCode();
158+
hashCode = (hashCode * 59) + RequestId.GetHashCode();
159159
return hashCode;
160160
}
161161
}

src/IO.Swagger.Lib.V3/Models/Result.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ public bool Equals(Result? other)
7575
if (ReferenceEquals(this, other)) return true;
7676

7777
return
78-
(
79-
Messages == other.Messages ||
80-
Messages != null &&
81-
Messages.SequenceEqual(other.Messages)
82-
);
78+
Messages == other.Messages ||
79+
(Messages != null &&
80+
Messages.SequenceEqual(other.Messages));
8381
}
8482

8583
/// <summary>
@@ -93,7 +91,7 @@ public override int GetHashCode()
9391
var hashCode = 41;
9492
// Suitable nullity checks etc, of course :)
9593
if (Messages != null)
96-
hashCode = hashCode * 59 + Messages.GetHashCode();
94+
hashCode = (hashCode * 59) + Messages.GetHashCode();
9795
return hashCode;
9896
}
9997
}

0 commit comments

Comments
 (0)