-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate partial objects as component schemas (#23)
The generated clients try to be smart and "re-use" schemas where possible. This makes for some really odd documentation and for go and php, some really odd types. e.g in the load balancer response, it says `certificates` property is type `GetDataCenters200ResponseDataCentersInnerCountry` which has nothing to do with the certificates. It's just that it uses the same properties. By "partial object" we mean that we return only some of the properties in the API response. e.g. we might sometimes only return the id and name properties of a `VirtualMachine`. Now we don't generate these type of schemas "inline" within the response. Actually this is recommended by Swagger anyway. And then we also no-longer even generate an inline object within any schema. The reason again is because of the way the generators attempt to "optimize" and re-use other schemas already defined. This does make for some verbose schema ids, such as: `PostLoadBalancerRules200ResponseLoadBalancerRuleLoadBalancer` Which is named as such because it needs to be unique: ``` PostLoadBalancerRules (the endpoint) 200Response (the type of response) LoadBalancerRuleLoadBalancer which follows the way the params are named and nested: { load_balancer_rule: { load_balancer: <the custom object> } } ``` Bill and I took a look at if there were any alternative solutions for these definitions within the openapi spec, but couldn't find any :( The upside is it simplifies our generator code. closes: #22
- Loading branch information
1 parent
85d1bc6
commit 17f9194
Showing
6 changed files
with
148 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.