-
Notifications
You must be signed in to change notification settings - Fork 14
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
Example of using auto mapper #435
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. |
Eh, this is an interesting exercise but not sure it's paying its weight. Using the mapper trips over inability to express the unions here like On the upside, using the mapper automatically checks that required field are set and provides warnings appropriately. It could also complain about fields it does not understand, if they are being set but cannot be parsed cleanly. |
I think unions are still a feature out there in the wild world of schemas. I'd keep this around w/o merging for a bit as something that informs the design of mapper module. Perhaps there's a trick we could teach mapper to do that would make working with unions more reasonable. |
@t0yv0 @guineveresaenger I think we can close this draft? |
Up to @guineveresaenger - I've not been up-to-date with latest docker changes, but strategically this still makes a lot of sense to me to finish up to make more custom resource development sustainable, so it should go on the backlog somewhere? That is:
Automatic code is less error prone, easier to read and can be made to more predictably handle missing values with localized error messages. Manually written code typically misses an error case here or there. I'm wondering though if there's something in the new-style provider SDK that can be used for this purpose instead of the automapper module from sdk/v3. |
Ah I see the request is tracked in pulumi/pulumi#11530 so that's good. Possibly need to put it on x-team request list. Without MarshalJSON/UnmarshalJSON style hooks in the automapper this is not practical. |
This would require a fix not yet in pulumi/pulumi: pulumi/pulumi#11537
Yet it may be promising - the code for converting between the typed model (Image, Build) and resource.PropertyValue can be automated via the mapper package - the boilerplate can be removed or reduced.