O hai! Speckle has some swagger specs behind it. I’ve exported my two tryouts from earlier into a swagger spec, for example.
You usually group them by “tags”, which this code generator doesn’t do (i’m playing with paw for reference), which then get nicely formatted & grouped together.
What was kind of really cool for the speckle api was actually something which this code gen doesn’t cover, namely the defintion of responses, payloads & data types etc. (see this - slightly over engineered, but i was learning). This might need to go hand in hand with actually defining what gets serialised and not, and might not be so easy to automate. But maybe as first step it wouldn’t be needed either…
Parsing the json below should give you the bare bones of what an open api spec should be like. Not sure how you would handle multiple payload types for the same endpoint
{
"swagger": "2.0",
"info": {
"title": "Hello World Compute",
"version": "v0.0.0"
},
"host": "compute.rhino3d.com",
"schemes": [
"https"
],
"basePath": "/Rhino/Geometry",
"paths": {
"/Circle/New": {
"post": {
"summary": "New Circle",
"description": "",
"operationId": "7474ddb6-4090-46c9-b15b-d5a684c59eb8",
"consumes": [
"application/json"
],
"parameters": [
{
"type": "string",
"default": "spam@dimitrie.org",
"name": "api_token",
"required": false,
"in": "header"
},
{
"required": false,
"schema": {
"type": "string",
"default": "[[1],[11],[21],[1211]]"
},
"in": "body",
"name": "body"
}
],
"responses": {
"default": {
"description": "no response description was provided for this operation"
}
}
}
},
"/Point3d/New": {
"post": {
"summary": "New Point",
"description": "",
"operationId": "69933433-0be6-45bf-a8a8-7948ea464fe2",
"consumes": [
"text/plain"
],
"parameters": [
{
"type": "string",
"default": "spam@dimitrie.org",
"name": "api_token",
"required": false,
"in": "header"
},
{
"required": false,
"schema": {
"type": "string",
"default": "[ 1,11.122 ,21 ]" // this is wrong
},
"in": "body",
"name": "body"
}
],
"responses": {
"default": {
"description": "no response description was provided for this operation"
}
}
}
}
},
"tags": []
}