-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resource methods: deduplicate request types between regular and body methods #166
base: master
Are you sure you want to change the base?
Conversation
@@ -417,10 +419,11 @@ function getMethodReturn( | |||
const name = schemas['Request'] ? 'client.Request' : 'Request'; | |||
|
|||
if (method.response) { | |||
const schema = schemas[checkExists(method.response.$ref)]; | |||
const schemaName = method.response.$ref; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated refactoring
@@ -461,34 +464,6 @@ export class App { | |||
return dir; | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.