GithubHelp home page GithubHelp logo

snugsfbay / data-weave-mock-data-generators-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mulesoft/data-weave-mock-data-generators-library

0.0 0.0 0.0 1.64 MB

License: BSD 3-Clause "New" or "Revised" License

DataWeave 100.00%

data-weave-mock-data-generators-library's Introduction

DataWeave Mock Data Generators Library

Development Branch

This library consolidates functions to generate random mock data for testing purposes.

Some of the use cases covered:

  • Different number format types
  • Age
  • Rate
  • Phone numbers
  • Zip Codes
  • Credit card numbers
  • User names
  • Email addresses

Overview

The following example shows some randomly generated mock data:

%dw 2.0
output application/json
import * from mocks::DataGenerators
---
(0 to 2) as Array map (v, i) -> {
    name: randomFirstName(),
    lastName: randomLastName(),
    email: randomEmailAddress(),
    age: randomAge(10) as String,
    addresses: (0 to 1) as Array map (v2, i2) -> {
        address: randomAddress(),
        city: randomCity(),
        country: randomCountry(),
        zipCode: randomZipCode() as String,
      }
}

Output:

[
  {
    "name": "Geertruida",
    "lastName": "Izarra",
    "email": "[email protected]",
    "age": "88",
    "addresses": [
      {
        "address": "7494 WHITE SHADOWS DR",
        "city": "Gonesse",
        "country": "Netherlands",
        "zipCode": "12121"
      },
      {
        "address": "4932 SPANISH CT",
        "city": "Künzell",
        "country": "United Kingdom",
        "zipCode": "19174"
      }
    ]
  },
  {
    "name": "Huihui",
    "lastName": "Goupil",
    "email": "[email protected]",
    "age": "93",
    "addresses": [
      {
        "address": "7083 EMORY AVE",
        "city": "Jawor",
        "country": "Bhutan",
        "zipCode": "18944"
      },
      {
        "address": "4868 BLUE WING LN",
        "city": "Airoli",
        "country": "Montserrat",
        "zipCode": "17981"
      }
    ]
  },
  {
    "name": "Margene",
    "lastName": "Raich",
    "email": "[email protected]",
    "age": "22",
    "addresses": [
      {
        "address": "1139 ROCKYBROOK DR",
        "city": "Reigate",
        "country": "Botswana",
        "zipCode": "17932"
      },
      {
        "address": "6695 BEAUTYBERRY AVE",
        "city": "Palakkad",
        "country": "Curacao",
        "zipCode": "10171"
      }
    ]
  }
]

Contributions Welcome

Contributions to this project can be made through Pull Requests and Issues on the GitHub Repository.

Before creating a pull request review the following:

When you submit your pull request, you are asked to sign a contributor license agreement (CLA) if we don't have one on file for you.

data-weave-mock-data-generators-library's People

Contributors

afelisatti avatar data-weave-github-app[bot] avatar dukesphere avatar mlischetti avatar mulesoft-es-bot avatar svacas avatar teofr avatar tomodc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.