Add ServiceStack reference typescript 404 error


I was trying to create typescript def’s for my service but getting 404 error, any idea’s why?

Console shows path as

Swagger UI seems to be working just fine for http://localhost/DocRecord/swagger-ui/

I figured it out, Metadata feature needed to be enabled for it to work.

is there is way to limit the dto’s by namespace? Excluding types is very tedious, it’ll be very useful to be able to filter by namespace.

These are the only TypeScript customization options available, you can use IncludeTypes to include a whitelist of types or ExcludeTypes to specify a blacklist.

Is there a possibility of adding namespace filters in future releases? I just spent 30 minutes listing all the types I needed and I am pretty sure I missed some.

Please submit any feature requests to UserVoice:

But if there’s so many why even specify them manually when you can include them all by default?

Because there are way too many to exclude. I need about 100 types from one namespace, total types are over 1000.


From ServiceStack v5.0.3 you can use .* and /* wildcard suffixes below:

Include Request DTO and its dependent types

You can include a Request DTO and all its dependent types with a .* suffix on the Request DTO, e.g:

/* Options:
IncludeTypes: GetTechnology.*

Which will include the GetTechnology Request DTO, the GetTechnologyResponse Response DTO and all Types that they both reference.

Include All Types within a C# namespace

If your DTOs are grouped into different namespaces they can be all included using the /* suffix, e.g:

/* Options:
IncludeTypes: MyApp.ServiceModel.Admin/*

This will incllude all DTOs within the MyApp.ServiceModel.Admin C# namespace.

Thanks, just curious if multiple namespaces can be used as well?

Yeah, as expected:

IncludeTypes: Namespace1/*, Namespace2/*

Awesome, Thanks.

I have another question,

For request types entities are also added with IReturn, but IReturn is a complex interface which I have excluded. But type still have extends IReturn<HttpResult>. Any way to not include base interface?

interface DocumentDownloadContentRequest extends IReturn
ContentId?: number;
Id?: number;

HttpResult should never be in referenced in your DTOs, it’s a server-only concept which wraps a Response with additional HTTP behavior, only the Response DTO it wraps should be declared in IReturn<TResponseDto>. The only dependency your DTOs should be referencing is ServiceStack.Interfaces.dll, if it’s referencing any other implementation .dll’s it’s no longer a clean Services Contract and you’ll run into interoperability issues when consumed from different languages.

You also shouldn’t use interfaces in place of concrete DTOs, it’s fine to have Request / Response DTOs implement the same interfaces, but should not be used as a substitute for a concrete type, e.g. as a Property Type or in IReturn<T> which should only ever contain the Response Type or a raw response like IReturn<string>, IReturn<byte[]>.

You don’t need to specify a IReturn<T> marker for your Request DTOs but then you wont be able to get a Typed API.

Having an issue with namespace filtering. It seems to be working for most part but any type that ends with name Response is not getting created in DTO file.

Should be resolved from the latest v5.0.3 on MyGet which you can download after clearing your NuGet cache.

Thanks for getting this done, You’re the man. :slight_smile: