-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
Description
We have Swagger json for end points that return more complex documents (objects inside of objects). This is represented with references inside of properties objects. Here is an example Swagger document that shows what we need:
{
"swagger": "2.0",
"info": {
"title": "Inventory API",
"description": "API to retrieve inventory information",
"version": "1.0.0"
},
"host": "api.company.com",
"schemes": [
"https"
],
"basePath": "/v3",
"produces": [
"application/json"
],
"paths": {
"/inventory/product/{product_code}": {
"get": {
"summary": "Product Inventory",
"description": "This end point takes a master product code and returns back the inventory for all variations of the master product.",
"parameters": [
{
"name": "product_code",
"in": "path",
"description": "The product code for the master product.",
"required": true,
"type": "string"
}
],
"tags": [
"Inventory"
],
"responses": {
"200": {
"description": "An Object with request, response, and error information. If successful the response will contain a body with inventory information for each of the variations for the master product.",
"schema": {
"$ref": "#/definitions/Response"
}
}
}
}
}
},
"definitions": {
"Body": {
"properties": {
"body": {
"type": "string"
}
}
},
"Request": {
"properties": {
"body": {
"$ref": "#/definitions/Body"
},
"this_url": {
"type": "string"
},
"help": {
"type": "string"
},
"server_received_time": {
"type": "string"
}
},
"required": [
"body",
"this_url",
"help",
"server_received_time"
]
},
"Variant": {
"properties": {
"upc_code": {
"type": "string"
},
"on_hand": {
"type": "integer"
},
"on_order": {
"type": "integer"
},
"ignore_inventory": {
"type": "boolean"
},
"ready_for_sale": {
"type": "boolean"
},
"store_on_hand": {
"type": "integer"
},
"find_in_store_on_hand": {
"type": "integer"
}
},
"required": [
"upc_code",
"on_hand",
"on_order",
"ignore_inventory",
"ready_for_sale",
"store_on_hand",
"find_in_store_on_hand"
]
},
"Result": {
"properties": {
"variants": {
"items": {
"$ref": "#/definitions/Variant"
},
"type": "array"
}
},
"required": [
"variants"
]
},
"Inventory": {
"properties": {
"help": {
"type": "string"
},
"messages": {
"$ref": "#/definitions/Messages"
}
},
"required": [
"help",
"messages"
]
},
"Message": {
"properties": {
"text": {
"type": "string"
},
"code": {
"type": "string"
}
},
"required": [
"text",
"code"
]
},
"Messages": {
"properties": {
"product": {
"items": {
"$ref": "#/definitions/Message"
},
"type": "array"
}
}
},
"Error": {
"properties": {
"inventory": {
"$ref": "#/definitions/Inventory"
}
}
},
"Response": {
"properties": {
"request": {
"$ref": "#/definitions/Request"
},
"response": {
"$ref": "#/definitions/Result"
},
"errors": {
"$ref": "#/definitions/Error"
}
},
"required": [
"request",
"response",
"errors"
]
}
}
}Running apidoc, I can see that support for this is a TODO (Field.scala line 105). Stepping through your tests (nice work, btw!) I can see that the swagger parser parses our document properly but additional coding is needed to move this into apidoc world. I'd very much like to work on this but it would be nice to do a bit of planning first to make sure I'm on the same page with you about how to add this functionality in.
Regards,
Dana
Reactions are currently unavailable