Skip to content

Commit

Permalink
fix: SL-80 more reasonable examples
Browse files Browse the repository at this point in the history
  • Loading branch information
karol-maciaszek authored and XVincentX committed Apr 10, 2019
1 parent 9f53eef commit 68025c6
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 19 deletions.
24 changes: 5 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,24 @@ _*TODO:* Create an executable which will run without needing to install a node m
Running Prism on the CLI will create a HTTP mock server.

```bash
$ prism mock examples/petstore.json
$ prism mock examples/petstore.oas3.json
> http://127.0.0.1:4010
```

Then in another tab, you can hit the HTTP server with your favorite HTTP client (like [HTTPie]):

```bash
$ http GET http://127.0.0.1:4010/pet/123
$ http GET http://127.0.0.1:4010/pets/123

HTTP/1.1 200 OK
Connection: keep-alive
content-length: 98
content-type: application/json

{
"name": "doggie",
"photoUrls": [
"fugiat",
"in amet"
],
"id": 38621518,
"category": {
"id": -77973282,
"name": "nisi"
},
"tags": [
{"id": 92329113, "name": "nulla"},
{"id": -72921961, "name": "esse"},
{"id": 38941757, "name": "velit incididunt quis ullamco magna"},
{"id": -14316986, "name": "occaecat exercitation cillum"}
],
"status": "available"
"id":-93918115,
"name":"magna",
"tag":"pariatur"
}
```

Expand Down
File renamed without changes.
File renamed without changes.
230 changes: 230 additions & 0 deletions examples/petstore.oas3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"license": {
"name": "MIT"
}
},
"servers": [
{
"url": "http://petstore.swagger.io/v1"
}
],
"paths": {
"/pets": {
"get": {
"summary": "List all pets",
"operationId": "listPets",
"tags": ["pets"],
"parameters": [
{
"name": "limit",
"in": "query",
"description": "How many items to return at one time (max 100)",
"required": false,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "A paged array of pets",
"headers": {
"x-next": {
"description": "A link to the next page of responses",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"required": ["id", "name"],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"required": ["code", "message"],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"post": {
"summary": "Create a pet",
"operationId": "createPets",
"tags": ["pets"],
"responses": {
"201": {
"description": "Null response"
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"required": ["code", "message"],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/pets/{petId}": {
"get": {
"summary": "Info for a specific pet",
"operationId": "showPetById",
"tags": ["pets"],
"parameters": [
{
"name": "petId",
"in": "path",
"required": true,
"description": "The id of the pet to retrieve",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Expected response to a valid request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"required": ["code", "message"],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Pet": {
"required": ["id", "name"],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
},
"Pets": {
"type": "array",
"items": {
"required": ["id", "name"],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
},
"Error": {
"required": ["code", "message"],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
}

0 comments on commit 68025c6

Please sign in to comment.