Skip to content

Commit 5c2f2ec

Browse files
authored
Package updates (#1698)
* Update kiota to v1.24.1 * Update Scalar to v2.0
1 parent 3356544 commit 5c2f2ec

File tree

6 files changed

+17
-53
lines changed

6 files changed

+17
-53
lines changed

.config/dotnet-tools.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"rollForward": false
3232
},
3333
"microsoft.openapi.kiota": {
34-
"version": "1.23.0",
34+
"version": "1.24.1",
3535
"commands": [
3636
"kiota"
3737
],

package-versions.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<MicrosoftApiServerVersion>9.0.*</MicrosoftApiServerVersion>
2323
<NSwagApiClientVersion>14.2.*</NSwagApiClientVersion>
2424
<NewtonsoftJsonVersion>13.0.*</NewtonsoftJsonVersion>
25-
<ScalarAspNetCoreVersion>1.2.*</ScalarAspNetCoreVersion>
25+
<ScalarAspNetCoreVersion>2.0.*</ScalarAspNetCoreVersion>
2626
<SwashbuckleVersion>7.*-*</SwashbuckleVersion>
2727
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>
2828
<TestSdkVersion>17.12.*</TestSdkVersion>

test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public string? NextRevalidation
8383
}
8484

8585
/// <summary>The password property</summary>
86-
public string? Password
86+
public byte[]? Password
8787
{
88-
get { return BackingStore?.Get<string?>("password"); }
88+
get { return BackingStore?.Get<byte[]?>("password"); }
8989
set { BackingStore?.Set("password", value); }
9090
}
9191

@@ -181,7 +181,7 @@ public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
181181
{ "firstName", n => { FirstName = n.GetStringValue(); } },
182182
{ "lastName", n => { LastName = n.GetStringValue(); } },
183183
{ "nextRevalidation", n => { NextRevalidation = n.GetStringValue(); } },
184-
{ "password", n => { Password = n.GetStringValue(); } },
184+
{ "password", n => { Password = n.GetByteArrayValue(); } },
185185
{ "phone", n => { Phone = n.GetStringValue(); } },
186186
{ "planet", n => { Planet = n.GetStringValue(); } },
187187
{ "profilePicture", n => { ProfilePicture = n.GetStringValue(); } },
@@ -209,7 +209,7 @@ public virtual void Serialize(ISerializationWriter writer)
209209
writer.WriteStringValue("firstName", FirstName);
210210
writer.WriteStringValue("lastName", LastName);
211211
writer.WriteStringValue("nextRevalidation", NextRevalidation);
212-
writer.WriteStringValue("password", Password);
212+
writer.WriteByteArrayValue("password", Password);
213213
writer.WriteStringValue("phone", Phone);
214214
writer.WriteStringValue("planet", Planet);
215215
writer.WriteStringValue("profilePicture", ProfilePicture);

test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public string? NextRevalidation
8383
}
8484

8585
/// <summary>The password property</summary>
86-
public string? Password
86+
public byte[]? Password
8787
{
88-
get { return BackingStore?.Get<string?>("password"); }
88+
get { return BackingStore?.Get<byte[]?>("password"); }
8989
set { BackingStore?.Set("password", value); }
9090
}
9191

@@ -181,7 +181,7 @@ public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
181181
{ "firstName", n => { FirstName = n.GetStringValue(); } },
182182
{ "lastName", n => { LastName = n.GetStringValue(); } },
183183
{ "nextRevalidation", n => { NextRevalidation = n.GetStringValue(); } },
184-
{ "password", n => { Password = n.GetStringValue(); } },
184+
{ "password", n => { Password = n.GetByteArrayValue(); } },
185185
{ "phone", n => { Phone = n.GetStringValue(); } },
186186
{ "planet", n => { Planet = n.GetStringValue(); } },
187187
{ "profilePicture", n => { ProfilePicture = n.GetStringValue(); } },
@@ -209,7 +209,7 @@ public virtual void Serialize(ISerializationWriter writer)
209209
writer.WriteStringValue("firstName", FirstName);
210210
writer.WriteStringValue("lastName", LastName);
211211
writer.WriteStringValue("nextRevalidation", NextRevalidation);
212-
writer.WriteStringValue("password", Password);
212+
writer.WriteByteArrayValue("password", Password);
213213
writer.WriteStringValue("phone", Phone);
214214
writer.WriteStringValue("planet", Planet);
215215
writer.WriteStringValue("profilePicture", ProfilePicture);

test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountAttributesInResponse.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public string? NextRevalidation
8383
}
8484

8585
/// <summary>The password property</summary>
86-
public string? Password
86+
public byte[]? Password
8787
{
88-
get { return BackingStore?.Get<string?>("password"); }
88+
get { return BackingStore?.Get<byte[]?>("password"); }
8989
set { BackingStore?.Set("password", value); }
9090
}
9191

@@ -181,7 +181,7 @@ public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
181181
{ "firstName", n => { FirstName = n.GetStringValue(); } },
182182
{ "lastName", n => { LastName = n.GetStringValue(); } },
183183
{ "nextRevalidation", n => { NextRevalidation = n.GetStringValue(); } },
184-
{ "password", n => { Password = n.GetStringValue(); } },
184+
{ "password", n => { Password = n.GetByteArrayValue(); } },
185185
{ "phone", n => { Phone = n.GetStringValue(); } },
186186
{ "planet", n => { Planet = n.GetStringValue(); } },
187187
{ "profilePicture", n => { ProfilePicture = n.GetStringValue(); } },
@@ -209,7 +209,7 @@ public virtual void Serialize(ISerializationWriter writer)
209209
writer.WriteStringValue("firstName", FirstName);
210210
writer.WriteStringValue("lastName", LastName);
211211
writer.WriteStringValue("nextRevalidation", NextRevalidation);
212-
writer.WriteStringValue("password", Password);
212+
writer.WriteByteArrayValue("password", Password);
213213
writer.WriteStringValue("phone", Phone);
214214
writer.WriteStringValue("planet", Planet);
215215
writer.WriteStringValue("profilePicture", ProfilePicture);

test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs

+3-39
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public async Task Cannot_exceed_min_length_constraint()
233233
{
234234
LastName = newAccount.LastName,
235235
// Using -3 instead of -1 to compensate for base64 padding.
236-
Password = Convert.ToBase64String(Enumerable.Repeat((byte)'X', SocialMediaAccount.MinPasswordChars - 3).ToArray())
236+
Password = Enumerable.Repeat((byte)'X', SocialMediaAccount.MinPasswordChars - 3).ToArray()
237237
}
238238
}
239239
};
@@ -271,7 +271,7 @@ public async Task Cannot_exceed_max_length_constraint()
271271
Attributes = new AttributesInCreateSocialMediaAccountRequest
272272
{
273273
LastName = newAccount.LastName,
274-
Password = Convert.ToBase64String(Enumerable.Repeat((byte)'X', SocialMediaAccount.MaxPasswordChars + 1).ToArray())
274+
Password = Enumerable.Repeat((byte)'X', SocialMediaAccount.MaxPasswordChars + 1).ToArray()
275275
}
276276
}
277277
};
@@ -292,42 +292,6 @@ public async Task Cannot_exceed_max_length_constraint()
292292
errorObject.Source.Pointer.Should().Be("/data/attributes/password");
293293
}
294294

295-
[Fact]
296-
public async Task Cannot_use_invalid_base64()
297-
{
298-
// Arrange
299-
SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne();
300-
301-
using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory);
302-
ModelStateValidationClient apiClient = new(requestAdapter);
303-
304-
var requestBody = new CreateSocialMediaAccountRequestDocument
305-
{
306-
Data = new DataInCreateSocialMediaAccountRequest
307-
{
308-
Type = SocialMediaAccountResourceType.SocialMediaAccounts,
309-
Attributes = new AttributesInCreateSocialMediaAccountRequest
310-
{
311-
LastName = newAccount.LastName,
312-
Password = "not-a-valid-base64-string"
313-
}
314-
}
315-
};
316-
317-
// Act
318-
Func<Task> action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody);
319-
320-
// Assert
321-
ErrorResponseDocument document = (await action.Should().ThrowExactlyAsync<ErrorResponseDocument>()).Which;
322-
document.Errors.Should().HaveCount(1);
323-
324-
ErrorObject errorObject = document.Errors.First();
325-
errorObject.Title.Should().Be("Input validation failed.");
326-
errorObject.Detail.Should().Be("The Password field is not a valid Base64 encoding.");
327-
errorObject.Source.Should().NotBeNull();
328-
errorObject.Source.Pointer.Should().Be("/data/attributes/password");
329-
}
330-
331295
[Theory]
332296
[InlineData(-1)]
333297
[InlineData(-0.56)]
@@ -572,7 +536,7 @@ public async Task Can_create_resource_with_valid_properties()
572536
UserName = newAccount.UserName,
573537
CreditCard = newAccount.CreditCard,
574538
Email = newAccount.Email,
575-
Password = newAccount.Password,
539+
Password = Convert.FromBase64String(newAccount.Password!),
576540
Phone = newAccount.Phone,
577541
Age = newAccount.Age,
578542
ProfilePicture = newAccount.ProfilePicture!.ToString(),

0 commit comments

Comments
 (0)