Allow types and interfaces in defining the request details
mahirk opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
In using the json-schema generators I noticed that it does not convert out the request query, params or header into a JSON Schema. Further discovered that I am unable to describe the header and path params as follows:
request(
@headers
headers: SomeTypeHere,
@pathParams
pathParams: SomeOtherTypeHere
) {}
instead the request would have to be defined as follows:
request(
@headers
headers: { someString: string; },
@pathParams
pathParams: { someOtherString: string; }
) {}
In investigating the contract, I also noticed the lack of the above request details in the types
object of the contract.
Describe the solution you'd like
Remove getParameterTypeAsTypeLiteralOrThrow(parameter);
to permit interfaces to be used. After investigating the AST, I am looking into how the TypeReference
can be used to retrieve the PropertySignatures
.
The method can be replaced as getParameterPropertySignatures
and it can handle either getting the signatures from them TypeLiteral
or can use the TypeReference.Symbol
to retrieve the Declarations
and then the PropertySignatures
like getTargetDeclarationFromTypeReference
Location
spot/lib/src/parsers/headers-parser.ts
Line 30 in 70b768d