Skip to content

Commit e650190

Browse files
feat(client): add response validation option
chore(client): simplify field validations
1 parent 96b705e commit e650190

File tree

57 files changed

+256
-500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+256
-500
lines changed

src/ArcadeDotnet.Tests/Services/Tools/Formatted/FormattedServiceTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public async Task List_Works()
1414
[Fact]
1515
public async Task Get_Works()
1616
{
17-
var formatted = await this.client.Tools.Formatted.Get(new() { Name = "name" });
18-
_ = formatted;
17+
await this.client.Tools.Formatted.Get(new() { Name = "name" });
1918
}
2019
}

src/ArcadeDotnet/ArcadeClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public Uri BaseUrl
2929
init { this._options.BaseUrl = value; }
3030
}
3131

32+
public bool ResponseValidation
33+
{
34+
get { return this._options.ResponseValidation; }
35+
init { this._options.ResponseValidation = value; }
36+
}
37+
3238
public TimeSpan Timeout
3339
{
3440
get { return this._options.Timeout; }

src/ArcadeDotnet/Core/ClientOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public Uri BaseUrl
1717
set { _baseUrl = new(() => value); }
1818
}
1919

20+
public bool ResponseValidation { get; set; } = false;
21+
2022
public TimeSpan Timeout { get; set; } = TimeSpan.FromMinutes(1);
2123

2224
/// <summary>

src/ArcadeDotnet/IArcadeClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public interface IArcadeClient
1717

1818
Uri BaseUrl { get; init; }
1919

20+
bool ResponseValidation { get; init; }
21+
2022
TimeSpan Timeout { get; init; }
2123

2224
/// <summary>

src/ArcadeDotnet/Models/Admin/AuthProviders/AuthProviderCreateParamsProperties/Oauth2Properties/AuthorizeRequest.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,10 @@ public override void Validate()
162162
_ = this.Endpoint;
163163
_ = this.AuthMethod;
164164
_ = this.Method;
165-
if (this.Params != null)
166-
{
167-
foreach (var item in this.Params.Values)
168-
{
169-
_ = item;
170-
}
171-
}
165+
_ = this.Params;
172166
this.RequestContentType?.Validate();
173167
this.ResponseContentType?.Validate();
174-
if (this.ResponseMap != null)
175-
{
176-
foreach (var item in this.ResponseMap.Values)
177-
{
178-
_ = item;
179-
}
180-
}
168+
_ = this.ResponseMap;
181169
}
182170

183171
public AuthorizeRequest() { }

src/ArcadeDotnet/Models/Admin/AuthProviders/AuthProviderCreateParamsProperties/Oauth2Properties/RefreshRequest.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,10 @@ public override void Validate()
162162
_ = this.Endpoint;
163163
_ = this.AuthMethod;
164164
_ = this.Method;
165-
if (this.Params != null)
166-
{
167-
foreach (var item in this.Params.Values)
168-
{
169-
_ = item;
170-
}
171-
}
165+
_ = this.Params;
172166
this.RequestContentType?.Validate();
173167
this.ResponseContentType?.Validate();
174-
if (this.ResponseMap != null)
175-
{
176-
foreach (var item in this.ResponseMap.Values)
177-
{
178-
_ = item;
179-
}
180-
}
168+
_ = this.ResponseMap;
181169
}
182170

183171
public RefreshRequest() { }

src/ArcadeDotnet/Models/Admin/AuthProviders/AuthProviderCreateParamsProperties/Oauth2Properties/TokenIntrospectionRequest.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,22 +190,10 @@ public override void Validate()
190190
this.Triggers.Validate();
191191
_ = this.AuthMethod;
192192
_ = this.Method;
193-
if (this.Params != null)
194-
{
195-
foreach (var item in this.Params.Values)
196-
{
197-
_ = item;
198-
}
199-
}
193+
_ = this.Params;
200194
this.RequestContentType?.Validate();
201195
this.ResponseContentType?.Validate();
202-
if (this.ResponseMap != null)
203-
{
204-
foreach (var item in this.ResponseMap.Values)
205-
{
206-
_ = item;
207-
}
208-
}
196+
_ = this.ResponseMap;
209197
}
210198

211199
public TokenIntrospectionRequest() { }

src/ArcadeDotnet/Models/Admin/AuthProviders/AuthProviderCreateParamsProperties/Oauth2Properties/TokenRequest.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,10 @@ public override void Validate()
162162
_ = this.Endpoint;
163163
_ = this.AuthMethod;
164164
_ = this.Method;
165-
if (this.Params != null)
166-
{
167-
foreach (var item in this.Params.Values)
168-
{
169-
_ = item;
170-
}
171-
}
165+
_ = this.Params;
172166
this.RequestContentType?.Validate();
173167
this.ResponseContentType?.Validate();
174-
if (this.ResponseMap != null)
175-
{
176-
foreach (var item in this.ResponseMap.Values)
177-
{
178-
_ = item;
179-
}
180-
}
168+
_ = this.ResponseMap;
181169
}
182170

183171
public TokenRequest() { }

src/ArcadeDotnet/Models/Admin/AuthProviders/AuthProviderCreateParamsProperties/Oauth2Properties/UserInfoRequest.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,22 +188,10 @@ public override void Validate()
188188
this.Triggers.Validate();
189189
_ = this.AuthMethod;
190190
_ = this.Method;
191-
if (this.Params != null)
192-
{
193-
foreach (var item in this.Params.Values)
194-
{
195-
_ = item;
196-
}
197-
}
191+
_ = this.Params;
198192
this.RequestContentType?.Validate();
199193
this.ResponseContentType?.Validate();
200-
if (this.ResponseMap != null)
201-
{
202-
foreach (var item in this.ResponseMap.Values)
203-
{
204-
_ = item;
205-
}
206-
}
194+
_ = this.ResponseMap;
207195
}
208196

209197
public UserInfoRequest() { }

src/ArcadeDotnet/Models/Admin/AuthProviders/AuthProviderCreateRequestProperties/Oauth2Properties/AuthorizeRequest.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,10 @@ public override void Validate()
162162
_ = this.Endpoint;
163163
_ = this.AuthMethod;
164164
_ = this.Method;
165-
if (this.Params != null)
166-
{
167-
foreach (var item in this.Params.Values)
168-
{
169-
_ = item;
170-
}
171-
}
165+
_ = this.Params;
172166
this.RequestContentType?.Validate();
173167
this.ResponseContentType?.Validate();
174-
if (this.ResponseMap != null)
175-
{
176-
foreach (var item in this.ResponseMap.Values)
177-
{
178-
_ = item;
179-
}
180-
}
168+
_ = this.ResponseMap;
181169
}
182170

183171
public AuthorizeRequest() { }

0 commit comments

Comments
 (0)