Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
113 stars 86 forks source link

error CS0266: Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime' #1235

Open marcelghisi opened 1 year ago

marcelghisi commented 1 year ago

Hello in this below line related with my Certificate.cs generated file I`m receiving error below[error] any idea to help [file line] global::System.DateTime? Sample.API.Models.ICertificateInternal.RevocationStatusRevokedOn { get => ((Sample.API.Models.IRevocationStatusInternal)RevocationStatus).RevokedOn; set => ((Sample.API.Models.IRevocationStatusInternal)RevocationStatus).RevokedOn = value; }

[error] C:\Users\marcel.ghisi\Projects\venafi_autorest\generated\generated\api\Models\Certificate.cs(72,266): error CS0266: Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?) [C:\Users\marcel.ghisi\Projects\venafi_autorest\generated\SwissPkiRegistrationRestApi. csproj] C:\Users\marcel.ghisi\Projects\venafi_autorest\generated\generated\api\Models\CertificateOrder.cs(97,252): error CS0266: Cannot implicitly convert type 'System.DateT ime?' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?) [C:\Users\marcel.ghisi\Projects\venafi_autorest\generated\SwissPkiRegistrationRes tApi.csproj] C:\Users\marcel.ghisi\Projects\venafi_autorest\generated\generated\api\Models\CertificateOrder.cs(109,258): error CS0266: Cannot implicitly convert type 'System.Date Time?' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?) [C:\Users\marcel.ghisi\Projects\venafi_autorest\generated\SwissPkiRegistrationRe stApi.csproj] Write-Error: C:\Users\marcel.ghisi\Projects\venafi_autorest\generated\build-module.ps1:76:5``

any idea to help

dolauli commented 1 year ago

Would you share more details (swaggers, README.md of configuration) how you generate the PowerShell module?

marcelghisi commented 1 year ago

basically I have installed the node and npm instal -g autorest and added the json content from this swisspki swagger to test.json file and executed command below.

autorest --powershell --input-file:json.json --verbose --debug

after generation the build-module.ps1 fails.

the same json works in open-api-generator but with open api im having problems to get compatibility between ps5.1 and ps 7...basically openapi generator just works in ps7. then i have a question will it be possible to compile a version to work in ps 5.1 wit autorest?

marcelghisi commented 1 year ago

Hello Dolauli, do you think we will have a fix for this year? just to help my planning