Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e104ed2

Browse files
committed
long running
1 parent ddabd39 commit e104ed2

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

documentation/creating-swagger.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,50 @@ prevent the automatic encoding behavior.
606606
```
607607

608608
## Enable Asynchronous Operations with x-ms-long-running-operation<a name="longrunning"></a>
609-
>TODO: x-ms-long-running-operation
609+
Some requests like creating/deleting a resource cannot be carried out immediately. In such a situation, the server
610+
sends a 201 (Created) or 202 (Accepted) and provides a link to monitor the status of the request. When such an operation
611+
is marked with extension `"x-ms-long-running-operation": true,` in Swagger, the generated code will know how to fetch
612+
the link to monitor the status. It will keep on polling at regular intervals till the request reaches one of the
613+
terminal states`Succeeded|Failed|Canceled`.
614+
```json
615+
"paths": {
616+
"/products/{name}": {
617+
"put": {
618+
"operationId": "products_create",
619+
"x-ms-long-running-operation": true,
620+
"description": "A pageable list of Products.",
621+
"parameters": [
622+
{
623+
"name": "name",
624+
"in": "path",
625+
"required": true,
626+
"type": "string",
627+
"description": "The name of the Product."
628+
},
629+
{
630+
"name": "parameters",
631+
"in": "body",
632+
"required": true,
633+
"schema": {
634+
"$ref": "#/definitions/ProductCreateParameters"
635+
},
636+
"description": "The parameters to provide for the created product."
637+
}
638+
],
639+
"responses": {
640+
"200": {
641+
"schema": {
642+
"$ref": "#/definitions/Product"
643+
}
644+
},
645+
"202": {
646+
"description": ""
647+
}
648+
}
649+
}
650+
}
651+
}
652+
```
610653

611654
##Global parameters<a name="globalParam"></a>
612655
Swagger allows for parameters to be defined separately from the operation where they are used. By convention, AutoRest

0 commit comments

Comments
 (0)