Aida

Aida

  • Docs
  • Reference
  • Contributors

›Advanced Usage

Getting Started

  • Introduction
  • Installation
  • Creating Your First Model
  • Enriching Your Model
  • Introduction to Injectors
  • Introduction to Consumers

Advanced Usage

  • Introduction to Endpoints
  • Chaining Injectors
  • Putting It All Together

Extending Aida

  • Creating A Custom Injector

Reference

  • Defined Types
  • Data Model
  • Endpoints Model
  • Existing Injectors
  • Existing Consumers
  • Aida Config
  • Faked Data

Chaining Injectors

Injectors can be useful on their own, but we can make them even more powerful and cleanly separated if we can chain them. This can enable each injector to have a single responsibility, and we can build a more complex result by chaining injectors and building on top of each other.

As of now, there is no automatic way to specify dependencies between injectors. Automatic dependency resolution is on the roadmap, but for now, all you need to do is specify them in order, from the least dependent to the most dependent injector.

For example, you can have something like this (which will be used in the next example):

{
  "schemaDir": "./models",
  "outputDir": "./",
  "plugins": [
    {
      "name": "routes",
      "outputType": "none"
    },
    {
      "name": "faked-routes",
      "outputType": "file"
    },
    {
      "name": "open-api",
      "outputType": "file"
    }
  ]
}

In this case, both faked-routes and open-api injectors depend on the routes injector, so that is the order they are specified in. When Aida is run, the open-api and faked-routes will have access to the result generated by the routes injector.

All we have remaining is to combine everything we have learned so far into a real-world use case for Aida, so let's do that now.

← Introduction to EndpointsPutting It All Together →
Aida
Docs
Getting StartedReference
Community
Project Chat
More
GitHubStar
Copyright © 2018 Stevche Radevski