Closed padamstx closed 4 years ago
@smikulcik Hi Simon, I wanted to tag you as a reviewer on this PR, but I see you're not in the required team within the github.com/IBM org. Please feel free to take a look and provide feedback one way or another :)
I just pushed a new commit to this PR that includes the following:
**Foo
and *FooIntf
as model result types that need to be supported.I think (I hope) that this PR is now 100% complete and ready for the corresponding Generator changes to commence (famous last words, right?).
While working through the Go generator changes, I found even more opportunities to improve the Go core :) I just pushed a commit that enhances the BaseService.Request() method so that it can directly return various types of response body data via the 'result' parameter (and the DetailedResponse.Result field as well). These changes allow us to reduce the amount of code that we generate immediately after the call to BaseService.Request() within an operation method.
:tada: This PR is included in version 3.4.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 4.0.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Fixes: https://github.ibm.com/arf/planning-sdk-squad/issues/1613
This PR contains new unmarshal functions for primitive and model types in the Go core. This will be needed in the SDK generator changes to fix the referenced issue.
The "new" approach for unmarshalling JSON values (primitives and models) in the Go generator will be to generate a single
Unmarshal<model>()
function for each model. This generated function can then be passed as a parameter (along with the JSON input and a pointer to the unmarshal result) to the core's UnmarshalModel() function. UnmarshalModel() will use reflection to interpret the JSON input and the result to determine the appropriate type of unmarshal operation (e.g. a single model instance, a slice of models, a map of models, or a map of model slices).The new
UnmarshalPrimitive()
function will be invoked from within a model's generatedUnmarshal<model>()
function to unmarshal struct fields involving primitive types (e.g. a single instance of a primitive type, a slice of primitives, a map of primitives, a map of primitive slices, and a slice of maps of primitive slices).This PR contains only the changes in the Go core. There will be a corresponding PR for the SDK generator changes.
Note: there might be some additional tweaks needed to the code changes in this PR as I complete the corresponding SDK generator changes, but I wanted to get this PR submitted so the review process can begin. One change that I identified as I reviewed the code before submitting this PR is that there is a common piece of code within each of the private unmarshalModelXXX functions that I can pull out and implement in a private function. This will not change the overall behavior of those functions.