From our blog

Architectural guide to unify business rule and input pattern validation without compromising on code readability

By Varun Om on February 7, 2020

In ISCP we started validating requests with ServiceStack Fluent Validation (about five years ago). This was limited to pure input pattern validation (let's call it field validation) with no regards to correctness of the same in relation to the data in the database (business validation). The latter was done inside service method (if required). Later we introduced a service-agnostic manager layer and moved logic from service methods to managers. At managers we opted to creating separate validator types to offload business validation logic from manager methods for readability purposes.

Continue reading

Opt in mechanism to generate ServiceStack API documentation

By Abhilash on November 11, 2019

For one of our clients we built an API driven platform which could be consumed in two ways, either as a service using our front end or by integrating third party UI interfaces with the API. As one could guess API documentation plays a vital role in usability of such systems. We use ServiceStack as our web services framework and API documentation generation is built into the framework. The generated documentation is a JSON file that conforms to Open API, which is a specification and complete framework implementation for describing, producing, consuming, and visualizing restful web services.

Continue reading

Self-hosting documentation securely for an API platform with granular control on who can see what using filter policies

By Varun Om on October 31, 2019

Requirements Recently we've embarked on an adventure to move online documentation of an API platform for one of our clients from ReadMe to a self-hosted solution chiefly to provide granular access control capability required by the business. Self-hosting of documentation has two main elements: Endpoints – This is the API reference section with OpenAPI specification for each endpoint Articles – This section contains how-tos and other articles related to the system, workflows and security.

Continue reading

Applying template method design pattern

By Abhilash on October 9, 2019

Recently I worked on refactoring a piece of code which dealt with filtering DB entities based on certain attributes and there were different types of such filters each doing almost the same thing and the problem was, how to reuse the common logic while making sure that the specific details of filtering are the only thing each filter will have to worry about. To better explain the problem and its solution, consider an example of a banking system, different entities in the system are the client (the account holder), account, deposit, withdrawal, investment, investment sale, etc.

Continue reading