Skip to content

Commit

Permalink
'.me' namespace changed to '.users.item'
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsessanchez committed Sep 7, 2023
1 parent 6e2606e commit e969720
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CodeSnippetsReflection.OpenAPI.Test/JavaGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public async Task GeneratesSnippetForRequestWithDeltaAndSkipToken()
var snippetModel = new SnippetModel(requestPayload, ServiceRootUrl, await GetV1SnippetMetadata());
var result = _generator.GenerateCodeSnippet(snippetModel);
Assert.Contains("DeltaResponse result = deltaRequestBuilder.get(", result);
Assert.Contains("DeltaRequestBuilder deltaRequestBuilder = new com.microsoft.graph.me.calendarView.delta.DeltaRequestBuilder(", result);
Assert.Contains("DeltaRequestBuilder deltaRequestBuilder = new com.microsoft.graph.users.item.calendarview.delta.DeltaRequestBuilder(", result);
}

[Fact]
Expand Down Expand Up @@ -774,7 +774,7 @@ public async Task GeneratesObjectsInArray()
};
var snippetModel = new SnippetModel(requestPayload, ServiceRootUrl, await GetV1SnippetMetadata());
var result = _generator.GenerateCodeSnippet(snippetModel);
Assert.Contains("com.microsoft.graph.me.assignlicense.AssignLicensePostRequestBody assignLicensePostRequestBody = new com.microsoft.graph.me.assignlicense.AssignLicensePostRequestBody();", result);
Assert.Contains("com.microsoft.graph.users.item.assignlicense.AssignLicensePostRequestBody assignLicensePostRequestBody = new com.microsoft.graph.users.item.assignlicense.AssignLicensePostRequestBody();", result);
Assert.Contains("LinkedList<UUID> disabledPlans0 = new LinkedList<UUID>", result);
Assert.Contains("LinkedList<UUID> removeLicenses = new LinkedList<UUID>", result);
Assert.Contains("UUID.fromString(\"bea13e0c-3828-4daa-a392-28af7ff61a0f\")", result);
Expand Down Expand Up @@ -813,7 +813,7 @@ public async Task GeneratesCorrectCollectionTypeAndDerivedInstances()
};
var snippetModel = new SnippetModel(requestPayload, ServiceRootUrl, await GetV1SnippetMetadata());
var result = _generator.GenerateCodeSnippet(snippetModel);
Assert.Contains("SendMailPostRequestBody sendMailPostRequestBody = new com.microsoft.graph.me.sendmail.SendMailPostRequestBody()", result);
Assert.Contains("SendMailPostRequestBody sendMailPostRequestBody = new com.microsoft.graph.users.item.sendmail.SendMailPostRequestBody()", result);
Assert.Contains("LinkedList<Attachment> attachments = new LinkedList<Attachment>", result);// Collection defines Base type
Assert.Contains("new FileAttachment", result);// Individual items are derived types
Assert.Contains("byte[] contentBytes0 = Base64.getDecoder().decode(\"SGVsbG8gV29ybGQh\")", result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private static void WriteRequestExecutionPath(SnippetCodeGraph codeGraph, String
{// its a delta query and needs the opaque url passed over.
pathSegment = "deltaRequestBuilder.";
codeGraph.Parameters = new List<CodeProperty>();// clear the query parameters as these will be provided in the url directly.
payloadSb.AppendLine($"DeltaRequestBuilder deltaRequestBuilder = new com.{GetDefaultNamespaceName(codeGraph.ApiVersion)}.{GetFluentApiPath(codeGraph.Nodes, codeGraph).Replace("()","")}DeltaRequestBuilder(\"{codeGraph.RequestUrl}\", {ClientVarName}.getRequestAdapter()).");
payloadSb.AppendLine($"DeltaRequestBuilder deltaRequestBuilder = new com.{GetDefaultNamespaceName(codeGraph.ApiVersion)}.{GetFluentApiPath(codeGraph.Nodes, codeGraph).Replace("()","").Replace("me.", "users.item.").ToLowerInvariant()}DeltaRequestBuilder(\"{codeGraph.RequestUrl}\", {ClientVarName}.getRequestAdapter());");
responseAssignment = "DeltaResponse result = ";
}
else
Expand Down Expand Up @@ -449,7 +449,7 @@ private static string GetNamespaceName(string namespaceName, string apiVersion)
.Select(static x => ReplaceIfReservedName(x, "Namespace").ToLowerInvariant())
.Aggregate(static (z, y) => z + '.' + y);

return $"com.{GetDefaultNamespaceName(apiVersion)}.{normalizedNameSpaceName}.";
return $"com.{GetDefaultNamespaceName(apiVersion)}.{normalizedNameSpaceName.Replace("me.", "users.item.")}.";
}

private static string GetDefaultNamespaceName(string apiVersion) =>
Expand Down

0 comments on commit e969720

Please sign in to comment.