Azure / Azure/autorest.powershell

Media content-type header is not being generated for input file types.

Open
#1,286 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

The defined media type content description for an api path are not picked, instead the API treats the request as an application/octet-stream for all input file types.
image

image

To reproduce the issue:
1. Run autorest against the config file below ```autorest --title:"Identity.DirectoryManagement" config.yml --verbose```
```
powershell: true
version: latest
use: '@autorest/powershell@3.0.509' #Replace with '@autorest/powershell@2.x' for autorest v2
export-properties-for-dict: false
subject-prefix: '-Mg'
azure: false
input-file: "https://raw.githubusercontent.com/timayabi2020/AutorestFiles/main/directorymanagement.yaml"
output-folder: src\$(title)
clear-output-folder: true
use-internal-constructors: true
use-datetimeoffset : true
metadata:
authors: Microsoft Corporation
owners: Microsoft Corporation
companyName: Microsoft Corporation
description: 'Microsoft Graph PowerShell Cmdlets'
copyright: © Microsoft Corporation. All rights reserved.
tags: Microsoft Office365 Graph PowerShell PSModule PSIncludes_Cmdlet
requireLicenseAcceptance: true
licenseUri: https://aka.ms/devservicesagreement
projectUri: https://github.com/microsoftgraph/msgraph-sdk-powershell
iconUri: https://raw.githubusercontent.com/microsoftgraph/g-raph/master/g-raph.png
directive:
- no-inline:
- MicrosoftGraphSharepointIds
- MicrosoftGraphIdentitySet
- MicrosoftGraphItemReference
- MicrosoftGraphDirectoryObject
- MicrosoftGraphUser
- MicrosoftGraphDrive
- MicrosoftGraphListItem
- MicrosoftGraphPost
- MicrosoftGraphSectionGroup
- MicrosoftGraphTeam
- MicrosoftGraphRecipient
- MicrosoftGraphGroupPolicyCategory
- MicrosoftGraphPrinter
- MicrosoftGraphPrinterShare
- MicrosoftGraphGovernanceResource
- MicrosoftGraphGovernanceRoleAssignment
- MicrosoftGraphGovernanceRoleDefinition
- MicrosoftGraphWorkbookOperationError
- MicrosoftGraphParentLabelDetails
- MicrosoftGraphEdiscoveryTag
- MicrosoftGraphEdiscoverySourceCollection
- MicrosoftGraphContentType
- MicrosoftGraphColumnDefinition
- MicrosoftGraphGroupPolicyDefinition
- MicrosoftGraphGroupPolicyDefinitionValue
- MicrosoftGraphSynchronizationLinkedObjects
- MicrosoftGraphSecuritySecurity
- MicrosoftGraphTeamSummary
- MicrosoftGraphSecurityInformationProtection
- MicrosoftGraphSecurityInformationProtectionPolicySetting
- MicrosoftGraphSecuritySensitivityLabel
- MicrosoftGraphTaskViewpoint
- MicrosoftGraphSecurityEdiscoveryReviewTag
- MicrosoftGraphSecurityEdiscoverySearch
- MicrosoftGraphManagedTenantsManagementTemplateStep
- MicrosoftGraphPlannerTaskCreation
- MicrosoftGraphPlannerTeamsPublicationInfo
```
2. Go to Identity.DirectoryManagement.cs file under "generated\api\" folder. request.Content has been set to null.
image

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with config.yml and the referenced directorymanagement.yaml using the provided AutoRest command. Inspect generated\api\Identity.DirectoryManagement.cs, focusing on request.Content and the generated handling of input file media types; done means the defined media type is used instead of application/octet-stream or a null request body.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.