microsoft / microsoft/typespec

Need a helper for determining the logical rpc-style response type for http operations

Open
#3,012 2 comments 0 reactions 0 assignees View on GitHub
design:accepted triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

- Add a new property to HttpOperation and HttpOperationResponse
- Update `getHttpOperation` to populate these properties
- if a request/response type has a property decorated with `@body` (`@bodyRoot`) use its type as logicalRequest/logicalResponse
- Otherwise, determine the parameterVisibility for the request and the returnTypeVisibility for the response
- Use resolved parameter visisbility to call metadata.getEffectiveModelType() for the logicalRequestType
- Use resolved returnTypeVisibility to call metdata.getEffectiveModelType() for the logicalResponseType
- provide a separate property or method to return the set of properties that represent the payload (request or response)

```typescript

export interface HttpOperation {
/** The request payload */
logicalRequest: Type;
}
export interface HttpOperationResponse {
/** The logical RPC-style response */
logicalResponse: Type;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.