Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Hidi #1671

Merged
merged 28 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
546bd70
Update readme.md
njaci1 Apr 22, 2024
55fed51
Bump Microsoft.OData.Edm from 7.21.0 to 7.21.1
dependabot[bot] May 2, 2024
2c7d44e
Merge pull request #1651 from microsoft/dependabot/nuget/Microsoft.OD…
baywet May 3, 2024
761b982
- replaces sonar login by token
baywet May 6, 2024
5ee9df4
- removes unnecessary parameter
baywet May 6, 2024
51bb845
- removes caching due to invalidation problems
baywet May 6, 2024
f78f33a
Merge pull request #1656 from microsoft/feature/sonar-token
baywet May 7, 2024
3a2d5f3
Merge pull request #1637 from microsoft/njaci1-patch-1
darrelmiller May 7, 2024
725fbe2
Add logic to map primitives to simple types for types without format
MaggieKimani1 May 9, 2024
b466c37
Add test to validate
MaggieKimani1 May 9, 2024
c074339
Remove whitespace
MaggieKimani1 May 9, 2024
7fbe342
Bump Verify.Xunit from 24.1.0 to 24.2.0
dependabot[bot] May 9, 2024
a320630
Merge pull request #1662 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman May 13, 2024
0f77d61
Add nullable operator for nullable types
MaggieKimani1 May 13, 2024
3c36aee
- updates code of conduct to the latest standard
baywet May 14, 2024
64cda20
Merge pull request #1663 from microsoft/feature/code-of-conduct
baywet May 14, 2024
1865f32
Update README.md
MaggieKimani1 May 14, 2024
6a1ac5e
Merge pull request #1665 from microsoft/mk/update-readme
MaggieKimani1 May 14, 2024
e2e7556
Bump Microsoft.Windows.Compatibility from 8.0.4 to 8.0.5
dependabot[bot] May 14, 2024
70e42b3
Merge pull request #1666 from microsoft/dependabot/nuget/Microsoft.Wi…
baywet May 15, 2024
3be00e4
Merge pull request #1660 from microsoft/mk/handle-types-without-format
MaggieKimani1 May 16, 2024
4e392e1
Update pipeline to be 1ES compliant
MaggieKimani1 May 20, 2024
b42af09
Remove redundant tasks
MaggieKimani1 May 20, 2024
d8059a2
Remove task
MaggieKimani1 May 21, 2024
e1d5f4e
Merge pull request #1668 from microsoft/1esconversion
MaggieKimani1 May 21, 2024
899ff1f
---
dependabot[bot] May 21, 2024
020bf61
Merge pull request #1669 from microsoft/dependabot/nuget/Microsoft.Op…
baywet May 22, 2024
b36d694
Bump Hidi version (#1670)
millicentachieng May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
622 changes: 286 additions & 336 deletions .azure-pipelines/ci-build.yml

Large diffs are not rendered by default.

17 changes: 3 additions & 14 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,17 @@ jobs:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: ./.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: pwsh
run: |
New-Item -Path ./.sonar/scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
run: dotnet tool install dotnet-sonarscanner --create-manifest-if-needed
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
CollectCoverage: true
CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
shell: pwsh
run: |
./.sonar/scanner/dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.opencover.xml"
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.opencover.xml"
dotnet workload restore
dotnet build
dotnet test Microsoft.OpenApi.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
10 changes: 10 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

To provide feedback and ask questions you can use Stack Overflow with the [OpenAPI.NET](https://stackoverflow.com/questions/tagged/openapi.net) tag or use the OpenAPI.NET Slack channel which you can join by registering for the HTTP APIs team at http://slack.httpapis.com.
To provide feedback and ask questions you can use Stack Overflow with the [OpenAPI.NET](https://stackoverflow.com/questions/tagged/openapi.net) tag.
6 changes: 3 additions & 3 deletions src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Nullable>enable</Nullable>
<ToolCommandName>hidi</ToolCommandName>
<PackageOutputPath>./../../artifacts</PackageOutputPath>
<Version>1.4.2</Version>
<Version>1.4.3</Version>
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -34,8 +34,8 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="7.21.0" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.3" />
<PackageReference Include="Microsoft.OData.Edm" Version="7.21.1" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.4" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ This command accepts the following parameters:
hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json

3. CSDL--->OpenAPI conversion and filtering
hidi transform --input Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo
hidi transform --csdl Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo

4. CSDL Filtering by EntitySets and Singletons
hidi transform --cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml --ll trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.4" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.5" />
</ItemGroup>
<ItemGroup>
<Resource Include="Themes\Metro\HowToApplyTheme.txt" />
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
private static readonly Dictionary<Type, Func<OpenApiSchema>> _simpleTypeToOpenApiSchema = new()
{
[typeof(bool)] = () => new() { Type = "boolean" },

Check warning on line 17 in src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs

View workflow job for this annotation

GitHub Actions / Build

Define a constant instead of using this literal 'boolean' 4 times. (https://rules.sonarsource.com/csharp/RSPEC-1192)
[typeof(byte)] = () => new() { Type = "string", Format = "byte" },
[typeof(int)] = () => new() { Type = "integer", Format = "int32" },
[typeof(uint)] = () => new() { Type = "integer", Format = "int32" },
Expand Down Expand Up @@ -100,9 +100,11 @@
("boolean", null, false) => typeof(bool),
("integer", "int32", false) => typeof(int),
("integer", "int64", false) => typeof(long),
("integer", null, false) => typeof(int),
("number", "float", false) => typeof(float),
("number", "double", false) => typeof(double),
("number", "decimal", false) => typeof(decimal),
("number", null, false) => typeof(double),
("string", "byte", false) => typeof(byte),
("string", "date-time", false) => typeof(DateTimeOffset),
("string", "uuid", false) => typeof(Guid),
Expand All @@ -113,8 +115,10 @@
("string", "uri", false) => typeof(Uri),
("integer", "int32", true) => typeof(int?),
("integer", "int64", true) => typeof(long?),
("integer", null, true) => typeof(int?),
("number", "float", true) => typeof(float?),
("number", "double", true) => typeof(double?),
("number", null, true) => typeof(double?),
("number", "decimal", true) => typeof(decimal?),
("string", "byte", true) => typeof(byte?),
("string", "date-time", true) => typeof(DateTimeOffset?),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class OpenApiTypeMapperTests
public static IEnumerable<object[]> OpenApiDataTypes => new List<object[]>
{
new object[] { new OpenApiSchema { Type = "integer", Format = "int32"}, typeof(int) },
new object[] { new OpenApiSchema { Type = "integer", Format = null, Nullable = false}, typeof(int) },
new object[] { new OpenApiSchema { Type = "integer", Format = null, Nullable = true}, typeof(int?) },
new object[] { new OpenApiSchema { Type = "string" }, typeof(string) },
new object[] { new OpenApiSchema { Type = "number", Format = "double" }, typeof(double) },
new object[] { new OpenApiSchema { Type = "number", Format = "float", Nullable = true }, typeof(float?) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="Verify.Xunit" Version="24.1.0" />
<PackageReference Include="Verify.Xunit" Version="24.2.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
Expand Down
Loading