New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aida/injector-faked-routes

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aida/injector-faked-routes

Aida injector to create faked routes

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by12.5%
Maintainers
1
Weekly downloads
 
Created
Source

Injector - Faked Routes

Introduction

The Faked Routes injector generates a flat object with all defined endpoints, similar in structure to the .endpoints.js file, except that data models are replaced with mocked data.

Dependencies

The Faked Routes injector depends on:

  • @aida/injector-routes

Use Cases

The main use case for this injector is to mock endpoints with fake data. For now, this injector is supposed to be used for request-response endpoints. There is no support for streaming, websockets, or GraphQL yet. Moreover, the only supported response content type is "application/json". The results from this injector can be used by the @aida/consumer-faked-http consumer to mock APIs without making network calls to a backend.

Example

// This is an example of how the data generated by this injector looks like. For more details on how to use this with the faked-http consumer, check the consumer documentation.
const fakedRoutes = {
 "/users": {
    "put": {
      "operationId": "updateUser",
      "request": {
        "body": {
          "id": "27bd418b-05e0-4e40-9fb2-54a9ff7de038",
          "email": "Katlynn_Upton@gmail.com",
          "phoneNumber": "914.750.8191 x2376",
          "firstName": "Bobby"
        }
      },
      "response": {
        "200": {
          "application/json": {
            "id": "27bd418b-05e0-4e40-9fb2-54a9ff7de038",
            "email": "Katlynn_Upton@gmail.com",
            "phoneNumber": "914.750.8191 x2376",
            "firstName": "Bobby"
          }
        },
        "400": {
          "application/json": {
            "description": "Quod officiis voluptatem dicta provident est. Aliquid sint aperiam."
          }
        }
      }
    }
  },
  "/users/{id}": {
    "get": {
      "operationId": "getUser",
      "request": {
        "path": {
          "id": "27bd418b-05e0-4e40-9fb2-54a9ff7de038"
        }
      },
      "response": {
        "200": {
          "application/json": {
            "id": "27bd418b-05e0-4e40-9fb2-54a9ff7de038",
            "email": "Katlynn_Upton@gmail.com",
            "phoneNumber": "914.750.8191 x2376",
            "firstName": "Bobby"
          }
        }
      }
    }
  }
}

API

options

  • seed: An integer to serve as the seed for the random data generation. Defaults to 12.

FAQs

Package last updated on 17 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc