Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
110 stars 76 forks source link

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

Open timayabi2020 opened 7 months ago

timayabi2020 commented 7 months ago

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
dolauli commented 7 months ago

@timayabi2020 Would you please post a link to config.yml?

isra-fel commented 7 months ago

Xiaogang to look into the swagger file https://raw.githubusercontent.com/timayabi2020/AutorestFiles/main/directorymanagement.yaml

timayabi2020 commented 7 months ago

@dolauli https://[raw.githubusercontent.com/timayabi2020/AutorestFiles/main/config.yml](https://raw.githubusercontent.com/timayabi2020/AutorestFiles/main/config.yml)