Skip to content

Commit a2e30c3

Browse files
committed
fix: defaults to oas 3.1
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
1 parent 982a9b1 commit a2e30c3

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/Microsoft.OpenApi.OData.Reader/OpenApiConvertSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class OpenApiConvertSettings
6666
/// Gets/sets a value indicating whether the version of openApi to serialize to is v2.
6767
/// Currently only impacts nullable references for EdmTypeSchemaGenerator
6868
/// </summary>
69-
public OpenApiSpecVersion OpenApiSpecVersion { get; set; } = OpenApiSpecVersion.OpenApi3_0;
69+
public OpenApiSpecVersion OpenApiSpecVersion { get; set; } = OpenApiSpecVersion.OpenApi3_1;
7070

7171
/// <summary>
7272
/// Gets/sets a value indicating to set the OperationId on Open API operation.

src/OoasGui/MainForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public partial class MainForm : Form
2727
{
2828
private OpenApiFormat Format { get; set; } = OpenApiFormat.Json;
2929

30-
private OpenApiSpecVersion Version { get; set; } = OpenApiSpecVersion.OpenApi3_0;
30+
private OpenApiSpecVersion Version { get; set; } = OpenApiSpecVersion.OpenApi3_1;
3131

3232
private OpenApiConvertSettings Settings = new OpenApiConvertSettings();
3333

src/OoasUtil/ComLineProcesser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public bool Process()
245245

246246
if (Version == null)
247247
{
248-
Version = OpenApiSpecVersion.OpenApi3_0;
248+
Version = OpenApiSpecVersion.OpenApi3_1;
249249
}
250250

251251
if (KeyAsSegment == null)
@@ -432,7 +432,7 @@ private bool ProcessTarget(int version)
432432
return false;
433433
}
434434

435-
Version = version == 2 ? OpenApiSpecVersion.OpenApi2_0 : OpenApiSpecVersion.OpenApi3_0;
435+
Version = version == 2 ? OpenApiSpecVersion.OpenApi2_0 : OpenApiSpecVersion.OpenApi3_1;
436436
return true;
437437
}
438438

tool/UpdateDocs/Program.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ static async Task<int> Main(string[] args)
2222
{
2323
// we assume the path are existed for simplicity.
2424
string path = Directory.GetCurrentDirectory();
25-
string csdl = path + "/../../../../../docs/csdl";
26-
string oas20 = path + "/../../../../../docs/oas_2_0";
27-
string oas30 = path + "/../../../../../docs/oas3_0_0";
25+
string parentPath = Path.Combine(path, "..", "..", "..", "..", "..");
26+
string csdl = Path.Combine(parentPath, "docs", "csdl");
27+
string oas20 = Path.Combine(parentPath, "docs", "oas_2_0");
28+
string oas30 = Path.Combine(parentPath, "docs", "oas3_0_0");
29+
string oas31 = Path.Combine(parentPath, "docs", "oas3_1_0");
2830

2931
foreach (var filePath in Directory.GetFiles(csdl, "*.xml"))
3032
{
@@ -53,11 +55,14 @@ static async Task<int> Main(string[] args)
5355

5456
settings.EnableKeyAsSegment = true;
5557
settings.EnableUnqualifiedCall = true;
56-
var output = oas30 + "/" + fileName + ".json";
58+
var output = Path.Combine(oas31, fileName + ".json");
5759
var document = model.ConvertToOpenApi(settings);
60+
await File.WriteAllTextAsync(output, await document.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_1));
61+
62+
output = Path.Combine(oas30, fileName + ".json");
5863
await File.WriteAllTextAsync(output, await document.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_0));
5964

60-
output = oas20 + "/" + fileName + ".json";
65+
output = Path.Combine(oas20, fileName + ".json");
6166
await File.WriteAllTextAsync(output, await document.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi2_0));
6267

6368
Console.WriteLine("Output [ " + fileName + " ] Successful!");

0 commit comments

Comments
 (0)