Skip to content

Commit

Permalink
Merge latest changes from Dev (#1668)
Browse files Browse the repository at this point in the history
* Bump apidoctor from `927ac29` to `ce76ead` (#1656)

Bumps [apidoctor](https://github.com/OneDrive/apidoctor) from `927ac29` to `ce76ead`.
- [Commits](OneDrive/apidoctor@927ac29...ce76ead)

---
updated-dependencies:
- dependency-name: apidoctor
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fixes type names in collection initializers (#1657)

* Fixes reserved type escaping in collections

* Revert

* Fix snippets

* Bump xunit.runner.visualstudio from 2.4.5 to 2.5.0 (#1659)

Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.5 to 2.5.0.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](xunit/visualstudio.xunit@v2.4.5...2.5.0)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix PHP Snippets. (#1655)

* Fix issue with setting Odata types and OdataID

* Update the tests

* Change DateTime instantiation.

* Fix how array of enums are represented.

* Remove unused variable.

* Fix path parameter rendering.

* Remove unused imports.

* Fix indexer method name.

* Fix escaping reserved keywords in types.

* Bump xunit from 2.4.2 to 2.5.0 (#1658)

* Bump xunit from 2.4.2 to 2.5.0

Bumps [xunit](https://github.com/xunit/xunit) from 2.4.2 to 2.5.0.
- [Commits](xunit/xunit@2.4.2...2.5.0)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fixes test signature

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Omondi <andrew.omondi@microsoft.com>

* Bump Microsoft.AspNetCore.Authorization from 7.0.8 to 7.0.9 (#1662)

Bumps [Microsoft.AspNetCore.Authorization](https://github.com/dotnet/aspnetcore) from 7.0.8 to 7.0.9.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.8...v7.0.9)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Authorization
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump Microsoft.AspNetCore.Mvc.NewtonsoftJson from 7.0.8 to 7.0.9 (#1661)

Bumps [Microsoft.AspNetCore.Mvc.NewtonsoftJson](https://github.com/dotnet/aspnetcore) from 7.0.8 to 7.0.9.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.8...v7.0.9)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Mvc.NewtonsoftJson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump Microsoft.AspNetCore.Authentication.JwtBearer from 7.0.8 to 7.0.9 (#1663)

Bumps [Microsoft.AspNetCore.Authentication.JwtBearer](https://github.com/dotnet/aspnetcore) from 7.0.8 to 7.0.9.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.8...v7.0.9)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Authentication.JwtBearer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump Microsoft.VisualStudio.Web.CodeGeneration.Design (#1664)

Bumps [Microsoft.VisualStudio.Web.CodeGeneration.Design](https://github.com/dotnet/Scaffolding) from 7.0.7 to 7.0.8.
- [Release notes](https://github.com/dotnet/Scaffolding/releases)
- [Commits](https://github.com/dotnet/Scaffolding/commits)

---
updated-dependencies:
- dependency-name: Microsoft.VisualStudio.Web.CodeGeneration.Design
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump MSTest.TestFramework from 3.0.4 to 3.1.1 (#1666)

Bumps [MSTest.TestFramework](https://github.com/microsoft/testfx) from 3.0.4 to 3.1.1.
- [Release notes](https://github.com/microsoft/testfx/releases)
- [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md)
- [Commits](microsoft/testfx@v3.0.4...v3.1.1)

---
updated-dependencies:
- dependency-name: MSTest.TestFramework
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix more snippets concerning maps and enum casing. (#1660)

* Fix issue with setting Odata types and OdataID

* Update the tests

* Change DateTime instantiation.

* Fix how array of enums are represented.

* Remove unused variable.

* Fix path parameter rendering.

* Remove unused imports.

* Fix indexer method name.

* Fix escaping reserved keywords in types.

* Fix issue with enums and maps.

* Use unused parameter.

* Fix enum value casing.

* Fix issue with objects inside array or maps.

* Update CodeSnippetsReflection.OpenAPI/LanguageGenerators/PhpGenerator.cs

Co-authored-by: Eastman <andrueastman@users.noreply.github.com>

* Update CodeSnippetsReflection.OpenAPI/LanguageGenerators/PhpGenerator.cs

Co-authored-by: Eastman <andrueastman@users.noreply.github.com>

* Fix failing tests after review.

---------

Co-authored-by: Eastman <andrueastman@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eastman <andrueastman@users.noreply.github.com>
Co-authored-by: Andrew Omondi <andrew.omondi@microsoft.com>
  • Loading branch information
4 people authored Jul 18, 2023
1 parent 9d722be commit 3f84e4a
Show file tree
Hide file tree
Showing 21 changed files with 554 additions and 94 deletions.
4 changes: 2 additions & 2 deletions ChangesService.Test/ChangesService.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>

Expand Down
4 changes: 1 addition & 3 deletions ChangesService.Test/ChangesStoreShould.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,14 @@ public async Task SetDefaultLocaleInFetchChangeLogRecords(string locale)
}

[Fact]
public async Task<Dictionary<string, string>> GetWorkloadServiceMappingsFile()
public async Task GetWorkloadServiceMappingsFile()
{
// Arrange & Act
var workloadServiceMappings = await _changesStore.FetchWorkloadServiceMappingsAsync();

// Assert
Assert.NotNull(workloadServiceMappings);
Assert.Equal(106, workloadServiceMappings.Count);

return workloadServiceMappings;
}

public async Task<ChangeLogRecords> FetchChangeLogRecordsAsync(CultureInfo cultureInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
51 changes: 50 additions & 1 deletion CodeSnippetsReflection.OpenAPI.Test/CSharpGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ public async Task HandlesEmptyCollection()
};
var snippetModel = new SnippetModel(requestPayload, ServiceRootUrl, await GetV1SnippetMetadata());
var result = _generator.GenerateCodeSnippet(snippetModel);
Assert.Contains("PermissionGrantPoliciesAssigned = new List<String>", result);
Assert.Contains("PermissionGrantPoliciesAssigned = new List<string>", result);
}
[Fact]
public async Task CorrectlyHandlesOdataFunction()
Expand Down Expand Up @@ -795,6 +795,55 @@ public async Task GeneratesPropertiesWithSpecialCharacters() {
Assert.Contains("V80 = true,", result);//Assert that the property was pascal cased
}

[Fact]
public async Task GeneratesCorrectTypeInCollectionInitializer() {
var sampleJson = @"{
""workflow"":{
""category"": ""joiner"",
""description"": ""Configure new hire tasks for onboarding employees on their first day"",
""displayName"": ""Global onboard new hire employee"",
""isEnabled"": true,
""isSchedulingEnabled"": false,
""executionConditions"": {
""@odata.type"": ""#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions"",
""scope"": {
""@odata.type"": ""#microsoft.graph.identityGovernance.ruleBasedSubjectSet"",
""rule"": ""(department eq 'Marketing')""
},
""trigger"": {
""@odata.type"": ""#microsoft.graph.identityGovernance.timeBasedAttributeTrigger"",
""timeBasedAttribute"": ""employeeHireDate"",
""offsetInDays"": 1
}
},
""tasks"": [
{
""continueOnError"": false,
""description"": ""Enable user account in the directory"",
""displayName"": ""Enable User Account"",
""isEnabled"": true,
""taskDefinitionId"": ""6fc52c9d-398b-4305-9763-15f42c1676fc"",
""arguments"": []
},
{
""continueOnError"": false,
""description"": ""Send welcome email to new hire"",
""displayName"": ""Send Welcome Email"",
""isEnabled"": true,
""taskDefinitionId"": ""70b29d51-b59a-4773-9280-8841dfd3f2ea"",
""arguments"": []
}
]
}
}";
using var requestPayload = new HttpRequestMessage(HttpMethod.Post, $"{ServiceRootUrl}/identityGovernance/lifecycleWorkflows/workflows/{{workflowId}}/createNewVersion"){
Content = new StringContent(sampleJson, Encoding.UTF8, "application/json")
};
var snippetModel = new SnippetModel(requestPayload, ServiceRootUrl, await GetV1SnippetMetadata());
var result = _generator.GenerateCodeSnippet(snippetModel);
Assert.Contains("new List<Microsoft.Graph.Models.IdentityGovernance.TaskObject>", result);//Assert the type is escaped in the collection initializzer.
}

[Fact]
public async Task CorrectlyHandlesTypeFromInUrl()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit 3f84e4a

Please sign in to comment.