Replies: 3 comments 5 replies
-
An example of the implementation has already been developped here |
Beta Was this translation helpful? Give feedback.
0 replies
-
---
openapi: 3.0.0
info:
title: OpenAPI Car API
description: Sample OpenAPI API using cars
contact:
name: Laurent Broudoux
url: https://github.com/lbroudoux
email: laurent.broudoux@gmail.com
license:
name: MIT License
url: https://opensource.org/licenses/MIT
version: 1.0.0
paths:
/owner/{owner}/car:
get:
summary: List all cars of owner
description: List all cars of owner description
operationId: getCarsOp
parameters:
- name: owner
in: path
description: Result page wanted
required: true
schema:
type: integer
examples:
laurent_cars:
value: 0
maxime_cars:
value: 1
tom_cars:
value: 2
responses:
200:
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Car'
examples:
laurent_cars:
value:
[
{"name": "307", "model": "Peugeot 307", "year": 2003},
{"name": "jean-pierre", "model": "Peugeot Traveler", "year": 2017}
]
x-microcks-example:
delay: 1000
maxime_cars:
$ref: "#/components/examples/maxime_cars"
tom_cars:
value:
[
{"name": "Car 1", "model": "Bmw", "year": 2003},
]
components:
schemas:
Car:
required:
- name
properties:
name:
description: Name of the car
type: string
year:
description: Build year
type: integer
model:
description: Model of the car
type: string
examples:
maxime_cars:
value:
[
{"name": "123", "model": "Pewpew Moblie", "year": 2000}
]
x-microcks-example:
delay: 5000 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@lbroudoux could you comment on this? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In a front-end application, requests to the same API endpoint may exhibit different processing times.
Depending on the duration of these requests, a dynamic display of a spinner or direct rendering of the content is determined.
To facilitate testing and development, a mocked API endpoint is needed, providing responses with varying response times.
We already have an implementation of "Delays" in Microcks but it is per "endpoint+verb".
To add this feature we could add to the "Response" object a delay that is specific to it.
To import the data we could add "OpenAPI Extensions" such as "x-microcks-example" which would be placed at the exemple level and contain the "delay" in the form of a variable.
Beta Was this translation helpful? Give feedback.
All reactions