Skip to content

known-encoding

Id
@azure-tools/typespec-azure-core/known-encoding

Check for supported encodings.

Check that @encode uses a supported encoding for Azure services.

Known supported encodings:

Target typeSupported encodings
utcDateTime / offsetDateTimerfc3339, rfc7231, unixTimestamp
durationISO8601, seconds
bytesbase64, base64url
  • Area: API, SDK

Non-standard formats are transmitted as the raw, unencoded wire type, which hurts API and SDK usability.

This rule corresponds to the LintDiff rule ValidFormats.

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;

Known encoding on a model property:

model Foo {
@encode("rfc3339")
myDateTime: utcDateTime;
}

Known encoding on a scalar:

@encode("rfc3339")
scalar myDateTime extends utcDateTime;

Suppress only when required to match an existing API; otherwise use a standard format, encoding, or type.