Is it possible to generate ServiceStack DTOs from an OpenApi specification? - servicestack

I have a 3rd party API I need to use and it provides an Open API specification. Is it possible to generate ServiceStack DTOs from the specification for use with the standard JsonServiceClient or JsonHttpClient?

No ServiceStack’s Add Reference feature is generated from ServiceStack’s richer internal metadata, it’s not possible to generate the same Request/Response and DTO types from an Open API spec directly.

Related

Creating and Deserialize graph.microsoft.com objects

We are using graph.microsoft.com to integrate our .NET application with Office365. For each object like event and we are now creating our own classes. Can we automatically create the classes?
You can create your own classes for all of the type of graph.microsoft.com but this means you have to keep track of changes yourself and for the complex types this is quite some work. Better to use the Microsoft.Graph SDK for .NET:
https://www.nuget.org/packages/Microsoft.Graph
For .NET the SDK is at 1.0. For other platform you can find status at: https://graph.microsoft.io/en-us/code-samples-and-sdks

HTTP Archive format for Servicestack Services

Is there any quick way to automatically generate HAR for ServiceStack Services to be used for API Documentation tools like API Embed?
Why don't you use existing tools?
With Swagger API your API will be automatically documented and testable.
If you prefer, you can use ServiceStack Metadata page too. It's less sexy than Swagger, but it's ok, it does the job.

What are the client expected dependencies when using the new ServiceStack design guidance?

Given the most awesome release of the Visual Studio Extension for ServiceStack, I wanted to make sure that after creating my service with ServiceStack, that when I create a client to consume said services that I'm doing it correctly. By that I mean in a loosely coupled, high performance way.
Let's say that we examine the EmailContacts project so we're all on the same page. The Email Contacts project has a reference to both the EmailContacts.ServiceInterface and EmailContacts.ServiceModel, this is understandable as this IS the service. Now I want to consume this service from another .NET project, doesn't matter what type, console or web.
So my question is this "In the consumer application, will I add a reference to EmailContacts.ServiceInterface and EmailContacts.ServiceModel and use the ServiceStack C# client library?", I don't see where I have a choice not too.
Thank you,
Stephen
Keep Service Models in their own Assembly
The benefit of having a well-defined Service Contract where your DTO's are maintained in their own separate impl-free project is that clients will only ever need to reference your Services DTO's to use with one of ServiceStack's C#'s Generic Service Client to call any Service.
Add ServiceStack Reference
Clients are also able to avoid referencing any of your Server dlls if they use ServiceStack's Add ServiceStack Reference feature which provides another way for clients to access your Web Services DTO's.
Clients shouldn't reference any Server implementation projects
It's a code-smell if you find clients needing any reference other than your Service Model and ServiceStack's client libraries, which is an indication that your Service Models aren't in their own dependency and impl-free .dll, which shouldn't depend on anything other than ServiceStack.Interfaces.dll.

BreezeJS with ServiceStack?

I was wondering whether or not BreezeJS is compatible when using other technologies other than Web API and/or Entity Framework? As I'm currently in development of a SPA using Service Stack to retrieve data and ORMLite?
So I am curious how BreezeJS handle's this as I know it uses it's own API Controller usually with an extension of the DbContext class which Entity Framework uses. Thanks.
There is currently a sample called NoDb in the samples zip available on the breeze website. This sample does not use EF, but it does use WebApi. So I'd start by looking there. ( additional documentation on this sample should be added within a day or two as well).
In terms of using ServiceStack instead of WebApi, breeze supports the concept of a "dataServiceAdapter" and currently ships with two, an OData adapter and a WebApi adapter. It is certainly possible to write a ServiceStack adapter that breeze could use but this is not trivial. Please add this as a feature request ( and vote for it) on the breeze User Voice. We take these requests seriously.

Is there any API to generate XSD programmatically?

Is there any APIs which I can use to create XSD programmatically? I have seen Membrane SOA API which looks pretty good, but they have not provided documentation for the API.
Is there any other API I can use to generate XSD?
XSD is just XML with its own namespace. Any XML generation API (DOM or StAX) is fine. You could also use JAXB or XmlBeans to generate the code for xsd schema (Click to download) itself and create schema in a type-safe manner.
If you are looking for XSD specific library then I suggest Eclipse XSD library

Resources