Skip to content

Commit

Permalink
chore: 🐝 Update SDK - Generate (#24)
Browse files Browse the repository at this point in the history
* ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.276.0

* Update project file to version 0.7.0

---------

Co-authored-by: speakeasybot <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
3 people committed Apr 29, 2024
1 parent 2f93f69 commit 52dd411
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 143 deletions.
37 changes: 6 additions & 31 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
lockVersion: 2.0.0
id: f1a8c321-72a7-41c5-8f5e-3d925aeafa1a
management:
docChecksum: 2401c7030f847f72ab31c8f75de58a66
docChecksum: 2422daf10293e923232daf08349ae0ae
docVersion: 0.2.0
speakeasyVersion: 1.260.6
generationVersion: 2.311.1
releaseVersion: 0.6.0
configChecksum: 4c4aa1619dbdf97bfdc4c59ad3152678
speakeasyVersion: 1.276.0
generationVersion: 2.314.0
releaseVersion: 0.7.0
configChecksum: e61305d32a3a6ac9caf57da79f97e6f9
repoURL: https://github.com/StyraInc/opa-csharp.git
published: true
features:
csharp:
constsAndDefaults: 0.0.1
core: 3.7.0
core: 3.8.0
examples: 2.81.3
flattening: 2.81.1
globalServerURLs: 2.82.3
Expand All @@ -35,7 +35,6 @@ generatedFiles:
- Styra/OpenApi/Utils/SpeakeasyMetadata.cs
- Styra/OpenApi/Utils/URLBuilder.cs
- Styra/OpenApi/Utils/Utilities.cs
- Styra/OpenApi/Styra.OpenApi.csproj
- Styra/OpenApi/Models/Errors/SDKException.cs
- Styra/OpenApi/Models/Requests/ExecutePolicyRequest.cs
- Styra/OpenApi/Models/Requests/ExecutePolicyResponse.cs
Expand All @@ -60,29 +59,5 @@ generatedFiles:
- Styra/OpenApi/Models/Errors/ServerErrorErrors.cs
- Styra/OpenApi/Models/Errors/ServerError.cs
- Styra/OpenApi/Models/Errors/UnhealthyServer.cs
- docs/Models/Requests/ExecutePolicyRequest.md
- docs/Models/Requests/ExecutePolicyResponse.md
- docs/Models/Requests/ExecutePolicyWithInputRequestBody.md
- docs/Models/Requests/ExecutePolicyWithInputRequest.md
- docs/Models/Requests/ExecutePolicyWithInputResponse.md
- docs/Models/Requests/HealthRequest.md
- docs/Models/Requests/HealthResponse.md
- docs/Models/Components/SuccessfulPolicyEvaluation.md
- docs/Models/Components/Revision.md
- docs/Models/Components/Provenance.md
- docs/Models/Components/Result.md
- docs/Models/Components/Explain.md
- docs/Models/Components/GzipAcceptEncoding.md
- docs/Models/Components/Input.md
- docs/Models/Components/GzipContentEncoding.md
- docs/Models/Components/HealthyServer.md
- docs/Models/Errors/Location.md
- docs/Models/Errors/Errors.md
- docs/Models/Errors/ClientError.md
- docs/Models/Errors/ServerErrorLocation.md
- docs/Models/Errors/ServerErrorErrors.md
- docs/Models/Errors/ServerError.md
- docs/Models/Errors/UnhealthyServer.md
- docs/sdks/opaapiclient/README.md
- USAGE.md
- .gitattributes
3 changes: 2 additions & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
csharp:
version: 0.6.0
version: 0.7.0
additionalDependencies: []
author: Styra
clientServerStatusCodesAsErrors: true
company: Styra
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.269.1
speakeasyVersion: 1.276.0
sources: {}
targets: {}
workflow:
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
### Nuget

```bash
dotnet add reference path/to/Styra/OpenApi.csproj
dotnet add package Styra.OpenApi
```
<!-- End SDK Installation [installation] -->

Expand Down Expand Up @@ -141,13 +141,8 @@ var sdk = new OpaApiClient();
ExecutePolicyWithInputRequest req = new ExecutePolicyWithInputRequest() {
Path = "app/rbac",
RequestBody = new ExecutePolicyWithInputRequestBody() {
Input = Input.CreateInputMapOfany(
new Dictionary<string, object>() {
{ "user", "alice" },
{ "action", "read" },
{ "object", "id123" },
{ "type", "dog" },
},
Input = Input.CreateInputBoolean(
false,
),
},
};
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,14 @@ Based on:
### Generated
- [csharp v0.6.0] .
### Releases
- [NuGet v0.6.0] https://www.nuget.org/packages/Styra.OpenApi/0.6.0 - .
- [NuGet v0.6.0] https://www.nuget.org/packages/Styra.OpenApi/0.6.0 - .

## 2024-04-29 00:03:32
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.276.0 (2.314.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [csharp v0.7.0] .
### Releases
- [NuGet v0.7.0] https://www.nuget.org/packages/Styra.OpenApi/0.7.0 - .
90 changes: 45 additions & 45 deletions Styra/OpenApi/Models/Components/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ public class InputType
private InputType(string value) { Value = value; }

public string Value { get; private set; }
public static InputType MapOfany { get { return new InputType("mapOfany"); } }

public static InputType Boolean { get { return new InputType("boolean"); } }

public static InputType Str { get { return new InputType("str"); } }

public static InputType Number { get { return new InputType("number"); } }

public static InputType ArrayOfany { get { return new InputType("arrayOfany"); } }

public static InputType Number { get { return new InputType("number"); } }
public static InputType MapOfany { get { return new InputType("mapOfany"); } }

public static InputType Null { get { return new InputType("null"); } }

public override string ToString() { return Value; }
public static implicit operator String(InputType v) { return v.Value; }
public static InputType FromString(string v) {
switch(v) {
case "mapOfany": return MapOfany;
case "boolean": return Boolean;
case "str": return Str;
case "arrayOfany": return ArrayOfany;
case "number": return Number;
case "arrayOfany": return ArrayOfany;
case "mapOfany": return MapOfany;
case "null": return Null;
default: throw new ArgumentException("Invalid value for InputType");
}
Expand Down Expand Up @@ -71,23 +71,15 @@ public class Input {
public Input(InputType type) {
Type = type;
}
public Dictionary<string, object>? MapOfany { get; set; }
public bool? Boolean { get; set; }
public string? Str { get; set; }
public List<object>? ArrayOfany { get; set; }
public double? Number { get; set; }
public List<object>? ArrayOfany { get; set; }
public Dictionary<string, object>? MapOfany { get; set; }

public InputType Type { get; set; }


public static Input CreateMapOfany(Dictionary<string, object> mapOfany) {
InputType typ = InputType.MapOfany;

Input res = new Input(typ);
res.MapOfany = mapOfany;
return res;
}

public static Input CreateBoolean(bool boolean) {
InputType typ = InputType.Boolean;

Expand All @@ -104,6 +96,14 @@ public static Input CreateStr(string str) {
return res;
}

public static Input CreateNumber(double number) {
InputType typ = InputType.Number;

Input res = new Input(typ);
res.Number = number;
return res;
}

public static Input CreateArrayOfany(List<object> arrayOfany) {
InputType typ = InputType.ArrayOfany;

Expand All @@ -112,11 +112,11 @@ public static Input CreateArrayOfany(List<object> arrayOfany) {
return res;
}

public static Input CreateNumber(double number) {
InputType typ = InputType.Number;
public static Input CreateMapOfany(Dictionary<string, object> mapOfany) {
InputType typ = InputType.MapOfany;

Input res = new Input(typ);
res.Number = number;
res.MapOfany = mapOfany;
return res;
}

Expand All @@ -138,19 +138,6 @@ public class InputConverter : JsonConverter

if (json == "null") {
return null;
}
try
{
Dictionary<string, object>? mapOfany = ResponseBodyDeserializer.Deserialize<Dictionary<string, object>>(json, missingMemberHandling: MissingMemberHandling.Error);
return new Input(InputType.MapOfany) {
MapOfany = mapOfany
};
}
catch (Exception ex)
{
if (!(ex is Newtonsoft.Json.JsonReaderException || ex is Newtonsoft.Json.JsonSerializationException)) {
throw ex;
}
}
try {
var converted = Convert.ToBoolean(json);
Expand All @@ -164,6 +151,14 @@ public class InputConverter : JsonConverter
return new Input(InputType.Str) {
Str = json[1..^1]
};
}
try {
var converted = Convert.ToDouble(json);
return new Input(InputType.Number) {
Number = converted
};
} catch (System.FormatException) {
// try next option
}
try
{
Expand All @@ -177,14 +172,19 @@ public class InputConverter : JsonConverter
if (!(ex is Newtonsoft.Json.JsonReaderException || ex is Newtonsoft.Json.JsonSerializationException)) {
throw ex;
}
}
try {
var converted = Convert.ToDouble(json);
return new Input(InputType.Number) {
Number = converted
}
try
{
Dictionary<string, object>? mapOfany = ResponseBodyDeserializer.Deserialize<Dictionary<string, object>>(json, missingMemberHandling: MissingMemberHandling.Error);
return new Input(InputType.MapOfany) {
MapOfany = mapOfany
};
} catch (System.FormatException) {
// try next option
}
catch (Exception ex)
{
if (!(ex is Newtonsoft.Json.JsonReaderException || ex is Newtonsoft.Json.JsonSerializationException)) {
throw ex;
}
}

throw new InvalidOperationException("Could not deserialize into any supported types.");
Expand All @@ -202,11 +202,6 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer
writer.WriteRawValue("null");
return;
}
if (res.MapOfany != null)
{
writer.WriteRawValue(Utilities.SerializeJSON(res.MapOfany));
return;
}
if (res.Boolean != null)
{
writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean));
Expand All @@ -217,14 +212,19 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer
writer.WriteRawValue(Utilities.SerializeJSON(res.Str));
return;
}
if (res.Number != null)
{
writer.WriteRawValue(Utilities.SerializeJSON(res.Number));
return;
}
if (res.ArrayOfany != null)
{
writer.WriteRawValue(Utilities.SerializeJSON(res.ArrayOfany));
return;
}
if (res.Number != null)
if (res.MapOfany != null)
{
writer.WriteRawValue(Utilities.SerializeJSON(res.Number));
writer.WriteRawValue(Utilities.SerializeJSON(res.MapOfany));
return;
}

Expand Down
Loading

0 comments on commit 52dd411

Please sign in to comment.