known-encoding
@azure-tools/typespec-azure-core/known-encodingCheck that @encode uses a supported encoding for Azure services.
Known supported encodings:
| Target type | Supported encodings |
|---|---|
utcDateTime / offsetDateTime | rfc3339, rfc7231, unixTimestamp |
duration | ISO8601, seconds |
bytes | base64, base64url |
โ Incorrect
Section titled โโ IncorrectโUnknown encoding on a model property:
model Foo { @encode("custom-rfc") myDateTime: utcDateTime;}Unknown encoding on a scalar:
@encode("custom-rfc")scalar myDateTime extends utcDateTime;โ Correct
Section titled โโ CorrectโKnown encoding on a model property:
model Foo { @encode("rfc3339") myDateTime: utcDateTime;}Known encoding on a scalar:
@encode("rfc3339")scalar myDateTime extends utcDateTime;