Giter Site home page Giter Site logo

yaml-for-pact's Introduction

Build Status

YAML for Pact

You can now write pact.io contracts in YAML format.

YAML description should also contain the versions of client and producer, so that it can be automatically uploaded with correct tags.

How to use

The converter provides a simple CLI with following usage:

usage: YAML for Pact
 -d,--destination <destinationDirectory>   Destination directory for
                                           converted files
 -h,--help                                 Prints help
 -r,--recursive                            Use for recursive traversal of
                                           source directory
 -s,--source <sourceDirectory>             Source directory containing
                                           YAML Pact files

How to build

Just execute this job, and you will get an executable JAR in the build directory

./gradlew clean build

Supported YAML example

provider:
  name: server
consumer:
  name: client
interactions:
  - description: random endpoint returns some object with message and id
    request:
      method: GET
      path: /random
      headers:
        Accept: "application/json;charset=UTF-8"
    response:
      status: 200
      headers:
        Content-Type: "application/json;charset=UTF-8"
        Access-Control-Allow-Origin: "*"
      body: '{
               "id": 1234567890,
               "message": {
                 "text": "Extremely random text"
               }
             }'
      matchingRules:
        body:
          "$.id":
            matchers:
              - match: type
          "$.message":
            matchers:
              - match: type
          "$.message.text":
            matchers:
              - match: type
metadata:
  pactSpecification:
    version: "3.0.0"

yaml-for-pact's People

Contributors

dominick1993 avatar

Watchers

 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.