Skip to content

Commit

Permalink
- partial #219, #220, #221 excludes unsupported request content types…
Browse files Browse the repository at this point in the history
… via configuration
  • Loading branch information
baywet committed Jun 7, 2021
1 parent f39b006 commit 97da252
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Kiota.Builder/GenerationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ public class GenerationConfiguration {
public GenerationLanguage Language { get; set; } = GenerationLanguage.CSharp;
public string ApiRootUrl { get; set; } = "https://graph.microsoft.com/v1.0";
public List<string> PropertiesPrefixToStrip { get; set; } = new() { "@odata."};
public HashSet<string> IgnoredRequestContentTypes { get; set; } = new();
}
}
5 changes: 4 additions & 1 deletion src/Kiota.Builder/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ private void CreateRequestBuilderClass(CodeNamespace currentNamespace, OpenApiUr
// Add methods for Operations
if (currentNode.HasOperations(Constants.DefaultOpenApiLabel))
{
foreach(var operation in currentNode.PathItems[Constants.DefaultOpenApiLabel].Operations)
foreach(var operation in currentNode
.PathItems[Constants.DefaultOpenApiLabel]
.Operations
.Where(x => x.Value.RequestBody?.Content?.Any(y => !this.config.IgnoredRequestContentTypes.Contains(y.Key)) ?? true))
CreateOperationMethods(currentNode, operation.Key, operation.Value, codeClass);
}
CreatePathManagement(codeClass, currentNode, isRootClientClass);
Expand Down
4 changes: 4 additions & 0 deletions src/kiota/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"IgnoredRequestContentTypes": [
"multipart/form-data",
"application/x-www-form-urlencoded"
],
"Logging": {
"LogLevel": {
"Default": "Debug"
Expand Down

0 comments on commit 97da252

Please sign in to comment.