diff --git a/.github/ISSUE_TEMPLATE/01-kiota-bug.yml b/.github/ISSUE_TEMPLATE/01-kiota-bug.yml index c57677cabc..07a4b51dff 100644 --- a/.github/ISSUE_TEMPLATE/01-kiota-bug.yml +++ b/.github/ISSUE_TEMPLATE/01-kiota-bug.yml @@ -127,7 +127,7 @@ body: id: logs attributes: label: Debug output - description: Please copy and paste the output when using the `--debug`` flag. This will be automatically formatted into code, so no need for backticks. + description: Please copy and paste the output when using the `--ll debug`` flag. This will be automatically formatted into code, so no need for backticks. value: |
Click to expand log ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 2da8bb4080..7649b49a9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed python generation in scenarios with opening/closing tags for code comments. [#5636](https://github.com/microsoft/kiota/issues/5636) - Fixed Python error when a class inherits from a base class and implements an interface. [5637](https://github.com/microsoft/kiota/issues/5637) - Fix anyOf/oneOf generation in TypeScript. [5353](https://github.com/microsoft/kiota/issues/5353) +- Fixed invalid code in Php caused by "*/*/" in property description. [5635](https://github.com/microsoft/kiota/issues/5635) ## [1.20.0] - 2024-11-07 diff --git a/it/config.json b/it/config.json index 6295abf3cb..dab857bc52 100644 --- a/it/config.json +++ b/it/config.json @@ -33,13 +33,13 @@ "Language": "typescript", "Rationale": "https://github.com/microsoft/kiota/issues/5634" }, - { - "Language": "php", - "Rationale": "https://github.com/microsoft/kiota/issues/5635" - }, { "Language": "ruby", "Rationale": "https://github.com/microsoft/kiota/issues/1816" + }, + { + "Language": "php", + "Rationale": "https://github.com/microsoft/kiota/issues/5779" } ], "ExcludePatterns": [ @@ -259,4 +259,4 @@ "Suppressions": [], "IdempotencySuppressions": [] } -} \ No newline at end of file +} diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index f2cf772a79..ed5836a450 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -10,13 +10,13 @@ - - - - - - - + + + + + + + diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index ca3f38b5c7..a8f0b7203d 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -62,11 +62,11 @@ urllib3==2.2.3 ; python_version >= '3.7' wrapt==1.15.0 ; python_version < '3.11' -yapf==0.40.2 +yapf==0.43.0 zipp==3.21.0 ; python_version >= '3.7' -aiohttp==3.10.10 ; python_version >= '3.6' +aiohttp==3.11.2 ; python_version >= '3.6' aiosignal==1.3.1 ; python_version >= '3.7' diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index dae1baa52c..b43431c1f3 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -38,12 +38,12 @@ - - - - - - + + + + + + diff --git a/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs index b85e876273..cd6789a8fa 100644 --- a/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs @@ -47,7 +47,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.IncreaseIndent(); foreach (var enumProperty in enumProperties) { - writer.WriteLine($"public const {GetEnumValueName(enumProperty.Name)} = '{enumProperty.WireName}';"); + writer.WriteLine($"public const {GetEnumValueName(enumProperty.Name)} = \"{enumProperty.WireName}\";"); } } [GeneratedRegex(@"([A-Z]{1})", RegexOptions.Singleline, 500)] diff --git a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs index 67cee78295..230fa1b527 100644 --- a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs +++ b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs @@ -135,7 +135,7 @@ private string GetCollectionDocString(CodeParameter codeParameter) return codeParameter.Optional ? $"{doc}|null" : doc; } - internal static string RemoveInvalidDescriptionCharacters(string originalDescription) => originalDescription.Replace("\\", "/", StringComparison.OrdinalIgnoreCase); + internal static string RemoveInvalidDescriptionCharacters(string originalDescription) => originalDescription.Replace("\\", "/", StringComparison.OrdinalIgnoreCase).Replace("*/", string.Empty, StringComparison.OrdinalIgnoreCase); public override bool WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index c432b4450a..abce111d71 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -16,7 +16,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodeEnumWriterTests.cs index 62ce1a24ec..609434152f 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodeEnumWriterTests.cs @@ -52,7 +52,7 @@ public async Task WritesEnumAsync() Assert.Contains("use Microsoft\\Kiota\\Abstractions\\Enum", result); Assert.Contains("class", result); Assert.Contains("extends Enum", result); - Assert.Contains($"public const {optionName.ToUpperInvariant()} = '{optionName}'", result); + Assert.Contains($"public const {optionName.ToUpperInvariant()} = \"{optionName}\"", result); AssertExtensions.CurlyBracesAreClosed(result, 1); Assert.Contains(optionName, result); } diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs index a00225e813..4b96585405 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs @@ -246,4 +246,26 @@ public async Task WriteRequestOptionAsync() Assert.Contains("@var array|null $options", result); Assert.Contains("public ?array $options = null;", result); } + + [Fact] + public void WritePropertyWithDescription() + { + CodeProperty property = new CodeProperty + { + Name = "name", + Documentation = new() + { + DescriptionTemplate = "The name pattern that branches must match in order to deploy to the environment.Wildcard characters will not match `/`. For example, to match branches that begin with `release/` and contain an additional single slash, use `release/*/*`.For more information about pattern matching syntax, see the [Ruby File.fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch).", + }, + Type = new CodeType + { + Name = "string" + }, + Access = AccessModifier.Private + }; + parentClass.AddProperty(property); + propertyWriter.WriteCodeElement(property, languageWriter); + var result = stringWriter.ToString(); + Assert.DoesNotContain("/*/*", result); + } }