-
Notifications
You must be signed in to change notification settings - Fork 177
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
Feature: support automate function input secrets in C# SDK #3324
Conversation
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.
lgtm
Hey @cdriesler! I noticed your PR is failing on the formatting checks, not sure if we've run you through the setup yet but maybe we should. Meanwhile, you can just:
Which should run the right formatter for you ;) |
@AlanRynne ty! that did it. will definitely be finding you again for setup tips @gjedlicska I had to make some changes for formatting but also for a strange typing on |
Has the timeline to release this been discussed? Should it go into We're already days away from releasing 2.19 so if there is no 🔥 to put out let's target this into |
f9fb805
to
8fe01de
Compare
{ | ||
// `GetSchema` returning `null` indicates that the given type should not have a customised schema | ||
// Nullability of JSchemaTypeGenerationContext appears to be incorrect. | ||
#pragma warning disable CS8764 // Nullability of return type doesn't match overridden member (possibly because of nullability attributes). |
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.
I've opened an issue in the Netwonsoft repo, as the nullability of JSchemaGenerationProvider.GetSchema
appears incorrect JamesNK/Newtonsoft.Json.Schema#341
Description & motivation
Automate functions can flag certain inputs as secrets. This will guarantee that their values are redacted in the UI and in any logging during execution. In order for an input to be considered a secret, its JSONSchema property must have
writeOnly
specified astrue
.In any given language's SDK, we generate Automate JSONSchemas from a class within the source code. In Python, this is currently done with a pydantic class
SecretStr
, but the built inDataAnnotations
we use in C# do not provide a way to generatewriteOnly
.For "extension" cases like this, Newtonsoft provides the ability to implement and attach our own serialization logic, and so we've reached for that to support secrets in the C# SDK.
Changes:
SecretAttribute
annotation to the C# SDKJSchemaGenerationProvider
and setswriteOnly
to true on the generated (in-flight generation) schemaValidation of changes:
writeOnly
References