# Add Petstore test service using Swagger specification in local folder
$ swaggerfs add Petstore ./swagger.json http://petstore.swagger.io --basic-auth alice:secret
# Add Petstore test service using Swagger specification downloaded from URL
$ curl -sS http://petstore.swagger.io/v2/swagger.json | swaggerfs add Petstore - http://petstore.swagger.io --api-key BADC0DE
# List registered services
$ swaggerfs list
Petstore
# Show details of a registered service
$ swaggerfs show Petstore
{
"name": "Petstore",
"endpoint": "http:\/\/petstore.swagger.io\/v2",
"credentials": {
"apikey": "BADC0DE"
}
}
# Forget registered service
$ swaggerfs forget Petstore
$ swaggerfs mount Petstore /mnt/petstore
$ ls /mnt/petstore/
pet
store
user
$ ls /mnt/petstore/store
getInventory
placeOrder
getOrderById
deleteOrder
# curl -X GET --header 'Accept: application/json' 'http://petstore.swagger.io/v2/pet?status=pending'
$ SFS_HEADER="Accept: application/json" cat /mnt/petstore/paths/pet/findByStatus?status=pending
# Export example body content into temporary file
$ cat /mnt/petstore/pet > pet.json && cat pet.json
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 1,
"name": "string"
}
],
"status": "available"
}
# Edit request with actual values
$ vim pet.json
# Invoke the operation
$ SFS_HEADERS="Content-type: application/json" cat pet.json > /mnt/petstore/pet/addPet
# Export example body content into temporary file
$ cat /mnt/petstore/pet/getPetById/123456 > pet.json && cat pet.json
{
"id": 123456,
"category": {
"id": 02,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 1,
"name": "string"
}
],
"status": "available"
}
# Edit request with actual values
$ vim pet.json
# Invoke the operation
$ SFS_HEADERS="Content-type: application/json" cat pet.json > /mnt/petstore/pet/updatePet
fusermount -u /mnt/petstore
See LICENSE.