There is a small issue, which can be easily “work-arounded”, nevertheless I think it’s an issue.
This happened on v5.14 of ServiceStack, but I don’t think this was resolved in newer versions.
So there are two requests with the same name, but in different namespaces:
namespace n1 {
[Tag("tag1")]
public class MyRequest {
}
}
namespace n2 {
[Tag("tag2")]
public class MyRequest {
}
}
Following the instructions in https://docs.servicestack.net/typescript-add-servicestack-reference, I filtered the dto generation only for the requests with tag tag1
:
var nativeTypes = appHost.GetPlugin<NativeTypesFeature>();
nativeTypes.MetadataTypesConfig.IncludeTypes = new List<string> { "{tag1}" };
Thus, this results anyway in generating the n2.MyRequest
with tag2
in the dtos.ts
file using the x typescript
tool:
export class MyRequest
{
}
export class MyRequest
{
}
Currently, I just renamed the second request to MyRequest_v2
, but I think the service responsible for publishing the metadata for the x typescript
tool should be aware of the namespaces.
Small explanation on the model
The reason I implemented it like that is, those 2 requests have exactly the same functionality, but they are under different authentication scheme. So for different customers, depending on the licensing model, there might be only 1 service (or none at all) available.