microsoft / microsoft/typespec
Need a helper for determining the logical rpc-style response type for http operations
- 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
Assessment
This issue has not been assessed yet.