mulesoft-labs / Osprey Mock Service
Licence: other
Generate an API mock service from a RAML definition using Osprey
Stars: ✭ 106
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Osprey Mock Service
raml-typesystem
(deprecated) Typescript implementation of RAML type system
Stars: ✭ 15 (-85.85%)
Mutual labels: raml
Vim Yaml Folds
YAML, RAML, EYAML & SaltStack SLS folding for Vim
Stars: ✭ 59 (-44.34%)
Mutual labels: raml
home
This is the home page for the API specification toolbox.
Stars: ✭ 16 (-84.91%)
Mutual labels: raml
Raml For Jax Rs
This project is all about two way transformation of JAX-RS-annotated Java code to RAML API description and back.
Stars: ✭ 294 (+177.36%)
Mutual labels: raml
Raml Tester
Test if a request/response matches a given raml definition
Stars: ✭ 70 (-33.96%)
Mutual labels: raml
Api Designer
A web editor for creating and sharing RAML API specifications
Stars: ✭ 1,019 (+861.32%)
Mutual labels: raml
raml-javascript-generator
Generate a JavaScript API client from RAML
Stars: ✭ 30 (-71.7%)
Mutual labels: raml
Api Console
An interactive REST console based on RAML/OAS files
Stars: ✭ 848 (+700%)
Mutual labels: raml
commercetools-api-reference
commercetools API reference documentation
Stars: ✭ 41 (-61.32%)
Mutual labels: raml
raml-sublime-plugin
Syntax highlighter for the RESTful API Modeling Language
Stars: ✭ 49 (-53.77%)
Mutual labels: raml
Osprey
Generate Node.JS API middleware from a RAML definition
Stars: ✭ 429 (+304.72%)
Mutual labels: raml
Web Api
This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web API ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
Stars: ✭ 944 (+790.57%)
Mutual labels: raml
Osprey Mock Service
Generate an API mock service from a RAML definition using Osprey.
Usage
Global (CLI)
npm install -g osprey-mock-service
Start the service from the CLI. This will automatically use the baseUri
as the path to the mock service. For example, http://example.com/api
will result in http://localhost:{PORT}/api
.
osprey-mock-service -f api.raml -p 3000 --cors
Options
-
-f
Path to the root RAML definition (E.g./path/to/api.raml
) -
-p
Port number to bind the server locally -
--cors
Enable CORS with the API
Locally (JavaScript)
npm install osprey-mock-service --save
The mocking service simply accepts a RAML definition and returns a router that can be mounted into any Connect-style middleware layer or even used with http
. Best used with osprey
to support incoming validation automatically.
const ospreyMockService = require('osprey-mock-service')
const express = require('express')
const wap = require('webapi-parser').WebApiParser
const path = require('path')
const osprey = require('osprey')
async function main () {
const app = express()
const fpath = `file://${path.join(__dirname, 'api.raml')}`
let model = await wap.raml10.parse(fpath)
model = await wap.raml10.resolve(model)
app.use(osprey.server(model))
app.use(ospreyMockService(model))
app.listen(3000)
}
main()
Additional methods
-
createServer
Creates a mock service instance with Osprey -
createServerFromBaseUri
Creates a mock service with Osprey and uses the base URI path -
loadFile
Creates a mock service with Osprey and the base URI path from a RAML file
License
Apache License 2.0
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].