Azure / Azure/autorest.powershell

Use-DateTimeOffset is not support by AutoRest.PowerShell

Open
#584 5 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

According to [this guide](https://github.com/Azure/autorest/blob/master/docs/user/command-line-interface.md#commonly-used-settings), specifying `use-datetimeoffset` should change the type of date-time properties from `DateTime` to `DateTimeOffset`. This configuration seems not to be respected by AutoRest.PowerShell.

### Repro steps:
- Environment
``` ps
AutoRest code generation utility [cli version: 3.0.6187; node: v13.11.0, max-memory: 8192 gb]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core 'C:\Users\peter\.autorest\@autorest_core@3.0.6258\node_modules\@autorest\core\dist' (3.0.6258)
Loading AutoRest extension '@autorest/powershell' (~2.1.327->2.1.370)
Loading AutoRest extension '@autorest/remodeler' (~2.1.0->2.1.27)
WARNING: Schema violation: Data does not match any schemas from 'oneOf'
```
- Generation
``` ps
autorest --powershell --use-datetimeoffset --input-file:.\Users.user.yml
```
- [Users.user.yml](https://gist.github.com/peombwa/b036a1d4b70dfe4cccd6003cb5265022)

The generated models still have date-time properties of type `DateTime`.
``` cs
/// Backing field for property.
private global::System.DateTime? _createdDateTime;

/// The created date of the user object.
[Sample.API.Origin(Sample.API.PropertyOrigin.Owned)]
public global::System.DateTime? CreatedDateTime { get => this._createdDateTime; set => this._createdDateTime = value; }
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.