Skip to content

Commit 5f75521

Browse files
Remove Speakeasy overlay (#66)
* speakeasy: Remove overlay. Signed-off-by: Philip Conrad <[email protected]> * Styra/Opa: Add SDK changes. Signed-off-by: Philip Conrad <[email protected]> * Update project file version. Signed-off-by: Philip Conrad <[email protected]> --------- Signed-off-by: Philip Conrad <[email protected]>
1 parent cc66a14 commit 5f75521

20 files changed

+761
-776
lines changed

.speakeasy/gen.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
lockVersion: 2.0.0
22
id: f1a8c321-72a7-41c5-8f5e-3d925aeafa1a
33
management:
4-
docChecksum: 553ed43ff98c81b3e770c34850f0b5f5
4+
docChecksum: 54d33facef3aa19f358d15ab44e34141
55
docVersion: 0.2.0
6-
speakeasyVersion: 1.376.0
6+
speakeasyVersion: 1.376.1
77
generationVersion: 2.402.5
8-
releaseVersion: 1.3.0
9-
configChecksum: 8bf5fcab319b53e5be5a8ead50747add
10-
repoURL: https://github.com/StyraInc/opa-csharp.git
8+
releaseVersion: 1.3.3
9+
configChecksum: dcc8dc671230100c5c15b0872988f4e6
10+
repoURL: https://github.com/StyraInc/opa-csharp
1111
repoSubDirectory: Styra/Opa/OpenApi/
1212
published: true
1313
features:
@@ -68,8 +68,8 @@ generatedFiles:
6868
- Styra/Opa/OpenApi/Models/Components/GzipContentEncoding.cs
6969
- Styra/Opa/OpenApi/Models/Components/Location.cs
7070
- Styra/Opa/OpenApi/Models/Components/Errors.cs
71-
- Styra/Opa/OpenApi/Models/Components/ServerError.cs
72-
- Styra/Opa/OpenApi/Models/Components/ResponsesSuccessfulPolicyResponse.cs
71+
- Styra/Opa/OpenApi/Models/Components/ServerErrorWithStatusCode.cs
72+
- Styra/Opa/OpenApi/Models/Components/SuccessfulPolicyResponseWithStatusCode.cs
7373
- Styra/Opa/OpenApi/Models/Components/Responses.cs
7474
- Styra/Opa/OpenApi/Models/Components/BatchMixedResults.cs
7575
- Styra/Opa/OpenApi/Models/Components/BatchSuccessfulPolicyEvaluation.cs

.speakeasy/gen.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ generation:
1212
auth:
1313
oAuth2ClientCredentialsEnabled: false
1414
csharp:
15-
version: 1.3.0
15+
version: 1.3.3
1616
additionalDependencies: []
1717
author: Styra
1818
clientServerStatusCodesAsErrors: true

.speakeasy/overlay.yaml

-13
This file was deleted.

.speakeasy/workflow.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ sources:
44
openapi:
55
inputs:
66
- location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml
7-
overlays:
8-
- location: ./.speakeasy/overlay.yaml
97
registry:
108
location: registry.speakeasyapi.dev/styra/styra/openapi
119
targets:

NUGET.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ catch (Exception ex)
114114
{
115115
// handle exception
116116
}
117-
else if (ex is Models.Errors.ServerError)
117+
else if (ex is ServerError)
118118
{
119119
// handle exception
120120
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ catch (Exception ex)
270270
{
271271
// handle exception
272272
}
273-
else if (ex is Models.Errors.ServerError)
273+
else if (ex is ServerError)
274274
{
275275
// handle exception
276276
}

Styra/Opa/LogMessages.cs

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
// Source-generated logging messages for the OpaClient.
1+
// Source-generated logging messages for the OpaClient.
22
// Ref: https://learn.microsoft.com/en-us/dotnet/core/extensions/logging-library-authors#prefer-source-generated-logging
33
using Microsoft.Extensions.Logging;
44

55
namespace Styra.Opa;
66

77
internal static partial class LogMessages
88
{
9-
[LoggerMessage(
10-
Message = "Batch Query API unavailable, falling back to sequential OPA queries",
11-
Level = LogLevel.Warning)]
12-
internal static partial void LogBatchQueryFallback(
13-
this ILogger logger);
9+
[LoggerMessage(
10+
Message = "Batch Query API unavailable, falling back to sequential OPA queries",
11+
Level = LogLevel.Warning)]
12+
internal static partial void LogBatchQueryFallback(
13+
this ILogger logger);
1414

15-
[LoggerMessage(
16-
Message = "executing policy '{rule}' failed with exception: {message}",
17-
Level = LogLevel.Error)]
18-
internal static partial void LogQueryError(
19-
this ILogger logger,
20-
string rule,
21-
string message);
15+
[LoggerMessage(
16+
Message = "executing policy '{rule}' failed with exception: {message}",
17+
Level = LogLevel.Error)]
18+
internal static partial void LogQueryError(
19+
this ILogger logger,
20+
string rule,
21+
string message);
2222

23-
[LoggerMessage(
24-
Message = "default policy failed with exception: {message}",
25-
Level = LogLevel.Error)]
26-
internal static partial void LogDefaultQueryError(
27-
this ILogger logger,
28-
string message);
23+
[LoggerMessage(
24+
Message = "default policy failed with exception: {message}",
25+
Level = LogLevel.Error)]
26+
internal static partial void LogDefaultQueryError(
27+
this ILogger logger,
28+
string message);
2929

30-
[LoggerMessage(
31-
Message = "executing policy at '{rule}' succeeded, but OPA did not reply with a result",
32-
Level = LogLevel.Warning)]
33-
internal static partial void LogQueryNullResult(
34-
this ILogger logger,
35-
string rule);
30+
[LoggerMessage(
31+
Message = "executing policy at '{rule}' succeeded, but OPA did not reply with a result",
32+
Level = LogLevel.Warning)]
33+
internal static partial void LogQueryNullResult(
34+
this ILogger logger,
35+
string rule);
3636

37-
[LoggerMessage(
38-
Message = "executing server default policy succeeded, but OPA did not reply with a result",
39-
Level = LogLevel.Warning)]
40-
internal static partial void LogDefaultQueryNullResult(
41-
this ILogger logger);
37+
[LoggerMessage(
38+
Message = "executing server default policy succeeded, but OPA did not reply with a result",
39+
Level = LogLevel.Warning)]
40+
internal static partial void LogDefaultQueryNullResult(
41+
this ILogger logger);
4242
}

Styra/Opa/OpaBatchTypes.cs

+43-43
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using Newtonsoft.Json;
33
using Styra.Opa.OpenApi.Models.Components;
44

55
namespace Styra.Opa;
66

77
public class OpaBatchInputs : Dictionary<string, Dictionary<string, object>>
88
{
9-
public override string ToString()
10-
{
11-
return JsonConvert.SerializeObject(this);
12-
}
9+
public override string ToString()
10+
{
11+
return JsonConvert.SerializeObject(this);
12+
}
1313
}
1414

1515
public class OpaBatchResults : Dictionary<string, OpaResult>
1616
{
17-
public override string ToString()
18-
{
19-
return JsonConvert.SerializeObject(this);
20-
}
17+
public override string ToString()
18+
{
19+
return JsonConvert.SerializeObject(this);
20+
}
2121
}
2222

2323
public class OpaBatchErrors : Dictionary<string, OpaError>
2424
{
25-
public override string ToString()
26-
{
27-
return JsonConvert.SerializeObject(this);
28-
}
25+
public override string ToString()
26+
{
27+
return JsonConvert.SerializeObject(this);
28+
}
2929
}
3030

3131
// Used for converting inputs for the Batch Query API, and converting result types
3232
// into useful higher-level types.
3333
public static class DictionaryExtensions
3434
{
35-
public static Dictionary<string, Input> ToOpaBatchInputRaw(this Dictionary<string, Dictionary<string, object>> inputs)
35+
public static Dictionary<string, Input> ToOpaBatchInputRaw(this Dictionary<string, Dictionary<string, object>> inputs)
36+
{
37+
var opaBatchInputs = new Dictionary<string, Input>();
38+
foreach (var kvp in inputs)
3639
{
37-
var opaBatchInputs = new Dictionary<string, Input>();
38-
foreach (var kvp in inputs)
39-
{
40-
opaBatchInputs[kvp.Key] = Input.CreateMapOfAny(kvp.Value);
41-
}
42-
return opaBatchInputs;
40+
opaBatchInputs[kvp.Key] = Input.CreateMapOfAny(kvp.Value);
4341
}
42+
return opaBatchInputs;
43+
}
4444

45-
// The OpenApi.Models.Errors variant of the ServerError type.
46-
public static OpaBatchErrors ToOpaBatchErrors(this Dictionary<string, Styra.Opa.OpenApi.Models.Errors.ServerError> errors)
45+
// The OpenApi.Models.Errors variant of the ServerError type.
46+
public static OpaBatchErrors ToOpaBatchErrors(this Dictionary<string, Styra.Opa.OpenApi.Models.Errors.ServerError> errors)
47+
{
48+
var opaBatchErrors = new OpaBatchErrors();
49+
foreach (var kvp in errors)
4750
{
48-
var opaBatchErrors = new OpaBatchErrors();
49-
foreach (var kvp in errors)
50-
{
51-
opaBatchErrors[kvp.Key] = new OpaError(kvp.Value);
52-
}
53-
return opaBatchErrors;
51+
opaBatchErrors[kvp.Key] = new OpaError(kvp.Value);
5452
}
53+
return opaBatchErrors;
54+
}
5555

56-
// The OpenApi.Models.Components variant of the ServerError type.
57-
public static OpaBatchErrors ToOpaBatchErrors(this Dictionary<string, Styra.Opa.OpenApi.Models.Components.ServerError> errors)
56+
// The OpenApi.Models.Components variant of the ServerError type.
57+
public static OpaBatchErrors ToOpaBatchErrors(this Dictionary<string, Styra.Opa.OpenApi.Models.Components.ServerErrorWithStatusCode> errors)
58+
{
59+
var opaBatchErrors = new OpaBatchErrors();
60+
foreach (var kvp in errors)
5861
{
59-
var opaBatchErrors = new OpaBatchErrors();
60-
foreach (var kvp in errors)
61-
{
62-
opaBatchErrors[kvp.Key] = new OpaError(kvp.Value);
63-
}
64-
return opaBatchErrors;
62+
opaBatchErrors[kvp.Key] = new OpaError(kvp.Value);
6563
}
64+
return opaBatchErrors;
65+
}
6666

67-
public static OpaBatchResults ToOpaBatchResults(this Dictionary<string, SuccessfulPolicyResponse> responses)
67+
public static OpaBatchResults ToOpaBatchResults(this Dictionary<string, SuccessfulPolicyResponse> responses)
68+
{
69+
var opaBatchResults = new OpaBatchResults();
70+
foreach (var kvp in responses)
6871
{
69-
var opaBatchResults = new OpaBatchResults();
70-
foreach (var kvp in responses)
71-
{
72-
opaBatchResults[kvp.Key] = (OpaResult)kvp.Value;
73-
}
74-
return opaBatchResults;
72+
opaBatchResults[kvp.Key] = (OpaResult)kvp.Value;
7573
}
74+
return opaBatchResults;
75+
}
7676
}

0 commit comments

Comments
 (0)