diff --git a/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj b/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj
index adfbac12a..6d190d9f8 100644
--- a/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj
+++ b/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj
@@ -10,7 +10,7 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/CodeSnippetsReflection.OpenAPI.Test/CodeSnippetsReflection.OpenAPI.Test.csproj b/CodeSnippetsReflection.OpenAPI.Test/CodeSnippetsReflection.OpenAPI.Test.csproj
index 1797f05b2..9d44b4f3d 100644
--- a/CodeSnippetsReflection.OpenAPI.Test/CodeSnippetsReflection.OpenAPI.Test.csproj
+++ b/CodeSnippetsReflection.OpenAPI.Test/CodeSnippetsReflection.OpenAPI.Test.csproj
@@ -12,7 +12,7 @@
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/CodeSnippetsReflection.OpenAPI.Test/PythonGeneratorTests.cs b/CodeSnippetsReflection.OpenAPI.Test/PythonGeneratorTests.cs
index f35a6c5eb..ab53752fd 100644
--- a/CodeSnippetsReflection.OpenAPI.Test/PythonGeneratorTests.cs
+++ b/CodeSnippetsReflection.OpenAPI.Test/PythonGeneratorTests.cs
@@ -36,12 +36,12 @@ public async Task GeneratesTheCorrectSnippetForUsers()
Assert.Contains(".me.get()", result);
}
[Fact]
- public async Task GeneratesTheSnippetHeader()
+ public async Task GeneratesTheClientCommnet()
{
using var requestPayload = new HttpRequestMessage(HttpMethod.Get, $"{ServiceRootUrl}/me/messages");
var snippetModel = new SnippetModel(requestPayload, ServiceRootUrl, await GetV1SnippetMetadata());
var result = _generator.GenerateCodeSnippet(snippetModel);
- Assert.Contains("graph_client = GraphServiceClient(credentials, scopes)", result);
+ Assert.Contains("# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python", result);
}
[Fact]
public async Task GeneratesThePostMethodCall()
diff --git a/CodeSnippetsReflection.OpenAPI/CodeSnippetsReflection.OpenAPI.csproj b/CodeSnippetsReflection.OpenAPI/CodeSnippetsReflection.OpenAPI.csproj
index 10128cda5..313f1e5e3 100644
--- a/CodeSnippetsReflection.OpenAPI/CodeSnippetsReflection.OpenAPI.csproj
+++ b/CodeSnippetsReflection.OpenAPI/CodeSnippetsReflection.OpenAPI.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/CodeSnippetsReflection.OpenAPI/LanguageGenerators/PythonGenerator.cs b/CodeSnippetsReflection.OpenAPI/LanguageGenerators/PythonGenerator.cs
index a2a5677da..3a406ecd2 100644
--- a/CodeSnippetsReflection.OpenAPI/LanguageGenerators/PythonGenerator.cs
+++ b/CodeSnippetsReflection.OpenAPI/LanguageGenerators/PythonGenerator.cs
@@ -13,13 +13,14 @@ namespace CodeSnippetsReflection.OpenAPI.LanguageGenerators
public class PythonGenerator : ILanguageGenerator
{
private const string ClientVarName = "graph_client";
- private const string ClientVarType = "GraphServiceClient";
- private const string CredentialVarName = "credentials";
- private const string ScopesVarName = "scopes";
private const string RequestBodyVarName = "request_body";
private const string RequestConfigurationVarName = "request_configuration";
private const string RequestConfigurationType = "RequestConfiguration";
private const string RequestParametersPropertyName = "query_params";
+ private const string VersionInformationString = "# Code snippets are only available for the latest version. Current version is 1.x";
+
+ private const string InitializationInfoString = "# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python";
+
private static readonly HashSet ReservedTypeNames = new(StringComparer.OrdinalIgnoreCase)
{
@@ -67,13 +68,14 @@ public string GenerateCodeSnippet(SnippetModel snippetModel)
{
var indentManager = new IndentManager();
var codeGraph = new SnippetCodeGraph(snippetModel);
- var snippetBuilder = new StringBuilder($"{Environment.NewLine}{Environment.NewLine}" +
- $"{ClientVarName} = {ClientVarType}({CredentialVarName}, {ScopesVarName}){Environment.NewLine}{Environment.NewLine}");
+ var snippetBuilder = new StringBuilder();
+ snippetBuilder.AppendLine(InitializationInfoString);
WriteRequestPayloadAndVariableName(codeGraph, snippetBuilder, indentManager);
WriteRequestExecutionPath(codeGraph, snippetBuilder, indentManager);
var importStatements = GetImportStatements(snippetModel);
- snippetBuilder.Insert(0, string.Join(Environment.NewLine, importStatements));
+ snippetBuilder.Insert(0, VersionInformationString + Environment.NewLine);
+ snippetBuilder.Insert(VersionInformationString.Length + Environment.NewLine.Length, string.Join(Environment.NewLine, importStatements) + Environment.NewLine);
return snippetBuilder.ToString();
}
private static HashSet GetImportStatements(SnippetModel snippetModel)
diff --git a/FileService.Test/FileService.Test.csproj b/FileService.Test/FileService.Test.csproj
index 52c81b0a7..c83b70d8e 100644
--- a/FileService.Test/FileService.Test.csproj
+++ b/FileService.Test/FileService.Test.csproj
@@ -12,7 +12,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/GraphWebApi/GraphWebApi.csproj b/GraphWebApi/GraphWebApi.csproj
index 5dd541373..b5dbffe35 100644
--- a/GraphWebApi/GraphWebApi.csproj
+++ b/GraphWebApi/GraphWebApi.csproj
@@ -42,7 +42,6 @@
-
diff --git a/KnownIssuesService.Test/KnownIssuesService.Test.csproj b/KnownIssuesService.Test/KnownIssuesService.Test.csproj
index 7c42e6c70..3d8d49fdf 100644
--- a/KnownIssuesService.Test/KnownIssuesService.Test.csproj
+++ b/KnownIssuesService.Test/KnownIssuesService.Test.csproj
@@ -23,7 +23,7 @@
-
+
diff --git a/KnownIssuesService/KnownIssuesService.csproj b/KnownIssuesService/KnownIssuesService.csproj
index 25c7d13f0..859532c61 100644
--- a/KnownIssuesService/KnownIssuesService.csproj
+++ b/KnownIssuesService/KnownIssuesService.csproj
@@ -5,7 +5,6 @@
-
diff --git a/MockTestUtility/MockTestUtility.csproj b/MockTestUtility/MockTestUtility.csproj
index 0437ec612..723211695 100644
--- a/MockTestUtility/MockTestUtility.csproj
+++ b/MockTestUtility/MockTestUtility.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/OpenAPIService.Test/OpenAPIService.Test.csproj b/OpenAPIService.Test/OpenAPIService.Test.csproj
index 10108d148..fe31c72c0 100644
--- a/OpenAPIService.Test/OpenAPIService.Test.csproj
+++ b/OpenAPIService.Test/OpenAPIService.Test.csproj
@@ -27,7 +27,6 @@
-
diff --git a/OpenAPIService/OpenAPIService.csproj b/OpenAPIService/OpenAPIService.csproj
index 6e975273b..7d4b47ec5 100644
--- a/OpenAPIService/OpenAPIService.csproj
+++ b/OpenAPIService/OpenAPIService.csproj
@@ -10,9 +10,9 @@
-
+
-
+
diff --git a/PermissionsService/PermissionsService.csproj b/PermissionsService/PermissionsService.csproj
index 950575186..635b2b26d 100644
--- a/PermissionsService/PermissionsService.csproj
+++ b/PermissionsService/PermissionsService.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/apidoctor b/apidoctor
index b785f01f4..6804550cf 160000
--- a/apidoctor
+++ b/apidoctor
@@ -1 +1 @@
-Subproject commit b785f01f40d84c4f0a28a0210d10b4ded550ceeb
+Subproject commit 6804550cf5aa545818f3a66802be8316714e6cdb