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
Add Output.JsonSerialize to dotnet sdk #11556
Conversation
Changelog[uncommitted] (2022-12-09)Features
|
N.B. Luke looked at a similar function for NodeJS last hackathon: https://github.com/pulumi/pulumi/compare/lukehoban/outputhelpers I'm not sure we want to add all those functions in that branch as intrinsics but I'll commit to getting the object -> json string method done. |
@Zaid-Ajaj made the great point that this should probably handle nested outputs in the input structure. I'll see if we can support that properly as part of this. |
0ff1c20
to
a0b9c83
Compare
@AaronFriel's asked this to hold for a bit while we work out if access to the languages JSON serialization is the right approach, or if we should add this to pulumi-std so it always writes the JSON in exactly the same way and then provide a way for users to hook how pulumi marshals/unmarshals from pulumi property values to language types. |
f7d4bfb
to
45ea5af
Compare
This doesn't update codegen, we should update codegen but it looks to be simpler to do a release with this in and then update codegen to use it in the next release. |
For posterity and in case I find this PR in the future, I've retracted any issue I had with this in favor of doing the least surprising thing in each language, and to push the complexity into YAML and |
45ea5af
to
44ac584
Compare
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.
Looks great, very nice addition to the SDK
Plan is to add functions like this to _all_ the SDKs. JsonSerialization is _very_ language specific, dotnet for example uses System.Text.Json, go would use JsonMarshal, etc. So it's worth having it built into SDKs and then exposed as a PCL intrinsic (with the caveat that the cross-language result will be _valid_ JSON, but with no commmitment to formatting for example). This is just the first part of this work, to add it to the dotnet SDK (simply because I know that best).
44ac584
to
9484c15
Compare
bors merge |
Build succeeded: |
11556: Add Output.JsonSerialize to dotnet sdk r=Frassle a=Frassle <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> Plan is to add functions like this to _all_ the SDKs. JsonSerialization is _very_ language specific, dotnet for example uses System.Text.Json, go would use JsonMarshal, etc. So it's worth having it built into SDKs and then exposed as a PCL intrinsic (with the caveat that the cross-language result will be _valid_ JSON, but with no commmitment to formatting for example). This is just the first part of this work, to add it to the dotnet SDK (simply because I know that best). ## Checklist <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Service, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. --> Co-authored-by: Fraser Waters <fraser@pulumi.com>
Description
Plan is to add functions like this to all the SDKs. JsonSerialization is very language specific, dotnet for example uses System.Text.Json, go would use JsonMarshal, etc. So it's worth having it built into SDKs and then exposed as a PCL intrinsic (with the caveat that the cross-language result will be valid JSON, but with no commmitment to formatting for example).
This is just the first part of this work, to add it to the dotnet SDK (simply because I know that best).
Checklist
make changelog
and committed thechangelog/pending/<file>
documenting my change