-
Notifications
You must be signed in to change notification settings - Fork 25
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
Allow customization of JsonSerializationOptions #370
Comments
Make sense, thanks! There's already precedent for exposing System.Text.Json.JsonSerializerOptions from an API in our SDK: pulumi-dotnet/sdk/Pulumi/Core/Output.cs Line 318 in b035300
For now, another alternative workaround would be to get the config as a string value and the deserialize the JSON yourself using whatever deserializer/options you'd like. |
Easy to implement that is just add new constructor that allows you to provide options. If that's acceptable way I can provide PR. |
I don't think it'd be a new constructor. I think it'd be new overloads on the public T GetObject<T>(string key); // Existing
public T GetObject<T>(string key, System.Text.Json.JsonSerializerOptions options); // New
public Output<T>? GetSecretObject<T>(string key); // Existing
public Output<T>? GetSecretObject<T>(string key, System.Text.Json.JsonSerializerOptions options); // New
public T RequireObject<T>(string key); // Existing
public T RequireObject<T>(string key, System.Text.Json.JsonSerializerOptions options); // New
public Output<T> RequireSecretObject<T>(string key); // Existing
public Output<T> RequireSecretObject<T>(string key, System.Text.Json.JsonSerializerOptions options); // New
That'd be great, thanks! But let me discuss the proposal with the team first in our design meeting early next week. |
@rosieks, if you're still interested, we discussed the APIs I outlined above and are good add those, if you'd like to provide a PR. Please include tests. Thank you! |
Hello!
Issue details
Right now to deserialize configuration Pulumi use default settings for JsonSerializer. That means that if someone wants to use to use different configuration then it's forced to use eg
JsonPropertyName
and others tools on each class which makes code harder to read. It would be great if there was an option to override it and provide customJsonSerializerOptions
.Affected area/feature
The text was updated successfully, but these errors were encountered: