npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ramlizer

v0.0.4

Published

A strategizer for RAML

Downloads

10

Readme

ramlizer

It's a strategizer for RAML.

What?

More specifically it's an API mock service that supports the use of strategies, and allows configuration of the mocking service to follow specific strategies. For multiple RAML files.

Why?

Let's say you've got an API service with an endpoint. You've got some UI that displays differently depending on the response from that endpoint.

If your endpoint only behaves different due to backend changes, you don't have an easy way to trigger this from your UI, so how do you check your different UI states?

ramlizer solves this problem by letting you configure how a mock endpoint behaves, while the endpoint is still running. No stopping, changing conditions and restarting, it's all live and real-time.

How?

ramlizer runs its own API alongside your mocked API (hopefully you don't have a /ramlizer endpoint!). Call this API to configure how your mocked API responds.

The POST endpoint takes four parameters in a JSON payload:

  • route (The endpoint route to affect)
  • method (The http method to affect)
  • [nextResponseCode] (The next response code the endpoint should produce)
  • [nextExampleName] (The next named example the endpoint should use)

Usually RAML endpoints only have one example, so how to define multiple ones?

Multiple RAML examples

We use an undocumented RAML feature to let you specify multiple named examples for your endpoints, and then you select which example to run for the next call to the endpoint.

Here's an example of examples:

/login:
  post:
    responses:
      400:
        body:
          properties:
            errorList:
              type: object
              properties:
                fieldName:
                  type: string
                  example: 'field'
          examples:
            badUsername:
              errorList:
                -
                  fieldName: username
            badPassword:
              errorList:
                -
                  fieldName: password

And here's the JSON payload sent to ramlizer to select one of those examples:

{
  "route": "/login",
  "method": "post",
  "nextResponseCode": "400",
  "nextExampleName": "badPassword"
}

And here's the JSON response when you call the /login endpoint:

{
  "errorList": [
    {
      "fieldName": "password"
    }
  ]
}

Multiple RAML files

If you add multiple files to the target RAML folder, Ramlizer will process them all and create multiple end-points from your files.

Script options

--folder

This option sets the destination folder where the Ramlizer script will look for RAML files.

--port

This option sets the port Ramlizer will use. By default this is '8080'.

--endpoint

This option sets the endpoint Ramlizer will use for its endpoint. By default this is 'ramlizer'.