typespec icon indicating copy to clipboard operation
typespec copied to clipboard

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

Open markcowl opened this issue 1 year ago • 2 comments

  • 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)

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

markcowl avatar Mar 12 '24 22:03 markcowl

est: 8

markcowl avatar Mar 19 '24 17:03 markcowl

@markcowl does the 8 estimate include the time it will take to refactor the OpenAPI (and possibly Autorest?) emitter to use this new helper?

tjprescott avatar Apr 23 '24 15:04 tjprescott