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

excludes additional types for CSharp to avoid collision #1565

Merged
merged 5 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"ms-vscode.powershell",
"rebornix.ruby",
"visualstudioexptteam.vscodeintellicode",
"streetsidesoftware.code-spell-checker"
"streetsidesoftware.code-spell-checker",
"sswg.swift-lang"
],
"remoteUser": "vscode",
"features": {
Expand All @@ -50,8 +51,9 @@
"java": "latest",
"ruby": "latest",
"rust": "latest",
"powershell": "latest"
"powershell": "latest",
"swift": "latest"
},
"postCreateCommand":
"git config pull.rebase false && git config push.default simple && git config remote.origin.prune true && git config commit.gpgsign true && git config tag.gpgsign true && git config core.safecrlf false && gh repo clone microsoft/kiota-samples samples"
"git config pull.rebase false && git config push.default simple && git config remote.origin.prune true && git config commit.gpgsign true && git config tag.gpgsign true && git config core.safecrlf false && [ ! -d ./samples ] && gh repo clone microsoft/kiota-samples samples"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added support for enum options descriptions (C#/Go/Java/TypeScript). [#90](https://github.com/microsoft/kiota/issues/90)
- Added support for file parameters types. [#221](https://github.com/microsoft/kiota/issues/221)

### Changed

Expand Down
1 change: 1 addition & 0 deletions src/Kiota.Builder/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ private static CodeType GetPrimitiveType(OpenApiSchema typeSchema, string childT
var format = typeSchema?.Format ?? typeSchema?.Items?.Format;
var primitiveTypeName = (typeName?.ToLowerInvariant(), format?.ToLowerInvariant()) switch {
("string", "base64url") => "binary",
("file", _) => "binary",
("string", "duration") => "TimeSpan",
("string", "time") => "TimeOnly",
("string", "date") => "DateOnly",
Expand Down
3 changes: 3 additions & 0 deletions src/Kiota.Builder/Refiners/CSharpReservedTypesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ public class CSharpReservedTypesProvider : IReservedNamesProvider
{
private readonly Lazy<HashSet<string>> _reservedNames = new(() => new(StringComparer.OrdinalIgnoreCase)
{
"file", //system.io static types
"directory",
"path",
"task",
});
public HashSet<string> ReservedNames => _reservedNames.Value;
Expand Down
1 change: 1 addition & 0 deletions tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,7 @@ public void InheritedTypeWithInlineSchemaWorks() {
[InlineData("boolean", "", "boolean")]
[InlineData("", "byte", "binary")]
[InlineData("", "binary", "binary")]
[InlineData("file", null, "binary")]
[Theory]
public void MapsPrimitiveFormats(string type, string format, string expected){
var document = new OpenApiDocument() {
Expand Down