resource methods: deduplicate request types between regular and body methods#166
resource methods: deduplicate request types between regular and body methods#166declanvong wants to merge 2 commits intomasterfrom
Conversation
|
|
||
| if (method.response) { | ||
| const schema = schemas[checkExists(method.response.$ref)]; | ||
| const schemaName = method.response.$ref; |
There was a problem hiding this comment.
Unrelated refactoring
| return dir; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
No longer consumed or needed, since we've replaced it with a simpler method write.
| ...method.parameters, | ||
| // Construct request type, e.g. get(...) on InvitationsResource -> GetInvitationsRequest | ||
| const methodType = checkExists(getName(method.id)); | ||
| const methodParts = method.id?.split('.'); |
There was a problem hiding this comment.
As raised in the previous PR, we weren't including the parent path down to the resource method, which meant we'd get some interface duplication, e.g. NotesResource in the containeranalysis API.
Using method.id (looks something like containeranalysis.projects.notes.occurrences.list) instead of just resourceName (just notes) will let us process it into something like ListProjectsNotesOccurencesRequest, which is fully namespaced and shouldn't conflict.
| if (resource.resources) { | ||
| _.forEach(resource.resources, (_, childResourceName) => { | ||
| const childResourceInterfaceName = getResourceTypeName( | ||
| childResourceName | ||
| ); | ||
| out.property(childResourceName, childResourceInterfaceName); | ||
| }); | ||
| } |
There was a problem hiding this comment.
This has just been moved up from below, wasn't touched
| @@ -1,17 +1,18 @@ | |||
| import {promisify} from 'bluebird'; | |||
There was a problem hiding this comment.
My import sorter auto formatted this to be alphabetical 😅
|
Thank you for not giving up on this! |
|
haha, not completely ready yet, will assign you when it's done! |
No description provided.