-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
spec repo case: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/ApplicationInsights.LiveMetrics
typespec:
model DocumentBase {
documentType: string;
Properties?: string[];
}
model ExceptionDocument extends DocumentBase {
ExceptionType: string;
ExceptionMessage: string;
}
model RequestModel{
Documents:ExceptionDocument[];
}
@route("/documents")
interface Documents {
@post
publish(@body body: RequestModel): void;
}
## Example
```json
{
"title": "Publish Documents",
"operationId": "Documents_publish",
"parameters": {
"body": {
"Documents": [
{
"documentType": "Exception",
"ExceptionType": "System.ArgumentNullException",
"ExceptionMessage": "Value cannot be null",
"Properties": ["stream-1", "stream-2"]
}
]
}
}
}
Samples
async function publishDocuments(): Promise<void> {
const endpoint = process.env.TESTING_ENDPOINT || "";
const client = new TestingClient(endpoint);
await client.publish({
documents: [
{
documentType: "Exception",
exceptionType: "System.ArgumentNullException",
exceptionMessage: "Value cannot be null",
Properties: ["stream-1", "stream-2"], // ❌ Properties should be properties
},
],
});
}
async function main(): Promise<void> {
await publishDocuments();
}
main().catch(console.error);root case: https://github.com/Azure/autorest.typescript/blob/main/packages/typespec-ts/src/modular/helpers/typeHelpers.ts#L96
buildPropertyNameMapper does not process the base class properties.
Metadata
Metadata
Assignees
Labels
No labels