Skip to content

Instantly share code, notes, and snippets.

@lbroudoux
Last active July 29, 2022 20:17
Show Gist options
  • Save lbroudoux/75b4ea340d5ddecf9b27a06e7f18ab6d to your computer and use it in GitHub Desktop.
Save lbroudoux/75b4ea340d5ddecf9b27a06e7f18ab6d to your computer and use it in GitHub Desktop.
WeatherForecat API #yaml
---
openapi: 3.0.2
info:
title: WeatherForecast API
version: 1.0.0
description: A simple API for demonstrating dispatching capabilities in Microcks
contact:
name: Laurent Broudoux
url: https://github.com/lbroudoux
email: laurent.broudoux@gmail.com
license:
name: MIT License
url: https://opensource.org/licenses/MIT
paths:
/forecast:
get:
operationId: GetForecast
summary: Get forecast for region
parameters:
- examples:
unknown:
value: other
north:
value: north
west:
value: west
east:
value: east
south:
value: south
name: region
description: The region to get forecast for
schema:
type: string
in: query
required: true
- name: apiKey
description: Client API key
schema:
type: string
in: query
required: true
responses:
"200":
description: Weather forecast for region
content:
application/json:
schema:
$ref: '#/components/schemas/Forecast'
examples:
north:
value:
region: north
temp: -1.5
weather: snowy
visibility: 25
west:
value:
region: west
temp: 12.2
weather: rainy
visibility: 300
east:
value:
region: east
temp: -6.6
weather: frosty
visibility: 523
south:
value:
region: south
temp: 28.3
weather: sunny
visibility: 1500
"404":
description: Region is unknown
content:
application/json:
schema:
type: string
examples:
unknown:
value: "Region is unknown. Choose in north, west, east or south."
components:
schemas:
Forecast:
title: Root Type for Forecast
description: A weather forecast for a requested region
type: object
properties:
region:
type: string
temp:
format: double
type: number
weather:
type: string
visibility:
format: int32
type: integer
example:
region: west
temp: 25.2
weather: cloudy
visibility: 1000
@nagarro-randula
Copy link

For a post end point,Can we add multiple dispatching rules more than one attribute in the request body??Please help

{

        "cartId": "1232",
        "userId": "64536"

}

lets say if I want to validate both cartId and userId at the same time to mock two different responses ,is this possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment