Closed weidongxu-microsoft closed 3 months ago
The @encode should be added on the scalar type, not property of union type | null (it is utcDateTime to be @encode, not the property, nor union)
@encode
type
type | null
utcDateTime
If written as
@encode(DateTimeKnownEncoding.unixTimestamp, int64) epochDateTimeRequiredNullable: utcDateTime | null;
typespec-autorest would be wrong https://github.com/Azure/azure-rest-api-specs/blob/main/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json#L3411-L3423
playground https://cadlplayground.z22.web.core.windows.net/cadl-azure/?c=aW1wb3J0ICJAdHlwZXNwZWMvcmVzdCI7Cgp1c2luZyBUeXBlU3BlYy5IdHRwOwoKQHNlcnZpY2UoewogIHRpdGxlOiAiT3B0aW9uYWwiLAp9KQpuYW1lc3BhY2UgQ2FkbC7IHcQ9ZW5jb2RlKERhdGVUaW1lS25vd25FxBRpbmcudW5peMQWc3RhbXAsIGludDY0KQpzY2FsYXIgZXBvY2jIOCBleHRlbmRzIHV0Y8gUOwoKbW9kZWwgyHAg5ACizTdSZXF1aXJlZE51bGxhYuQAus5WfCBudWxsO9A3yC8%2FzzA7Cn0KCkByb3V0ZSgiL2%2FHdyIpCmludGVyZuQBAegAjE9w5QCOQHB1dMQHyDRwdXQiKQogIHB1dCgKICAgIEBib2R5yTY%2FOskLLAogICk6xUUgIEBoZWFkZXIgxgfoANY6IHN0cmluZ%2BQAwNAky1LNJcVvxAU%2FOiB7fcQVfTsKfQ%3D%3D&e=%40azure-tools%2Ftypespec-autorest&options=%7B%7D
The
@encode
should be added on the scalartype
, not property of uniontype | null
(it isutcDateTime
to be@encode
, not the property, nor union)If written as
typespec-autorest would be wrong https://github.com/Azure/azure-rest-api-specs/blob/main/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json#L3411-L3423