Skip to content

Commit

Permalink
feat: Updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Nov 13, 2024
1 parent a148b49 commit c03781f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 25 deletions.
3 changes: 2 additions & 1 deletion src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoSDK" Version="0.27.1-dev.22" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.6.22" />
</ItemGroup>

Expand Down
18 changes: 10 additions & 8 deletions src/helpers/FixOpenApiSpec/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
using System.Diagnostics.CodeAnalysis;
using AutoSDK.Helpers;
using Microsoft.OpenApi;
using Microsoft.OpenApi.Extensions;using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Readers;

var path = args[0];
var text = await File.ReadAllTextAsync(path);
var jsonOrYaml = await File.ReadAllTextAsync(path);

text = text
.Replace("\"openapi\":\"3.1.0\"", "\"openapi\":\"3.0.1\"")
;
if (OpenApi31Support.IsOpenApi31(jsonOrYaml))
{
jsonOrYaml = OpenApi31Support.ConvertToOpenApi30(jsonOrYaml);
}

var openApiDocument = new OpenApiStringReader().Read(text, out var diagnostics);
var openApiDocument = new OpenApiStringReader().Read(jsonOrYaml, out var diagnostics);

openApiDocument.Components.Schemas["prediction_response"] = FromJson(
/* language=json */
Expand Down Expand Up @@ -85,8 +87,8 @@
},
};

text = openApiDocument.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0);
_ = new OpenApiStringReader().Read(text, out diagnostics);
jsonOrYaml = openApiDocument.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0);
_ = new OpenApiStringReader().Read(jsonOrYaml, out diagnostics);

if (diagnostics.Errors.Count > 0)
{
Expand All @@ -99,7 +101,7 @@
Environment.Exit(1);
}

await File.WriteAllTextAsync(path, text);
await File.WriteAllTextAsync(path, jsonOrYaml);

static OpenApiSchema FromJson([StringSyntax(StringSyntaxAttribute.Json)] string json)
{
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/GenerateDocs/GenerateDocs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/TrimmingHelper/TrimmingHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>

<PublishTrimmed>true</PublishTrimmed>
Expand Down
12 changes: 2 additions & 10 deletions src/libs/Replicate/Replicate.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net4.6.2;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net4.6.2;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -20,19 +20,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net4.6.2'">
<Reference Include="System.Net.Http" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup Label="Base packages">
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.2" />
<PackageReference Include="MSTest" Version="3.6.3" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
</ItemGroup>

Expand Down

0 comments on commit c03781f

Please sign in to comment.