Skip to content
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

Can't get ipAddress field from azurenative.containerinstance.ContainerGroup #432

Open
polkx opened this issue Apr 3, 2024 · 7 comments
Open
Assignees
Labels
area/core The SDK's core code kind/bug Some behavior is incorrect or out of spec
Milestone

Comments

@polkx
Copy link
Collaborator

polkx commented Apr 3, 2024

When I try to get ipAddress (ipAddress = containerGroup.ipAddress.ip) from azurenative.containerinstance.ContainerGroup the Error shows up about deserializing an option.
The error disappears when I comment on the line ipAddress = containerGroup.ipAddress.ip.

Dependencies:

//> using scala "3.3.1"
//> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement
//> using plugin "org.virtuslab::besom-compiler-plugin:0.2.3-SNAPSHOT"
//> using dep "org.virtuslab::besom-core:0.2.3-SNAPSHOT"
//> using dep "org.virtuslab::besom-azure-native:2.34.0-core.0.2-SNAPSHOT"

Main class:

import besom.*
import besom.api.azurenative

@main def main = Pulumi.run {
  val resourceGroup = azurenative.resources.ResourceGroup(
    name = s"test-resource-group",
    azurenative.resources.ResourceGroupArgs(location = "East US")
  )
  val containerGroup = azurenative.containerinstance.ContainerGroup(
    name = s"test-container-group",
    azurenative.containerinstance.ContainerGroupArgs(
      resourceGroupName = resourceGroup.name,
      location = resourceGroup.location,
      osType = azurenative.containerinstance.enums.OperatingSystemTypes.Linux,
      containers = List(
        azurenative.containerinstance.inputs.ContainerArgs(
          name = "test",
          image = "nginx",
          resources = azurenative.containerinstance.inputs.ResourceRequirementsArgs(
            requests = azurenative.containerinstance.inputs.ResourceRequestsArgs(
              cpu = 1.0,
              memoryInGB = 1.5
            )
          ),
          ports = List(
            azurenative.containerinstance.inputs.ContainerPortArgs(
              port = 80
            )
          )
        )
      ),
      ipAddress = azurenative.containerinstance.inputs.IpAddressArgs(
        `type` = azurenative.containerinstance.enums.ContainerGroupIpAddressType.Public,
        ports = List(
          azurenative.containerinstance.inputs.PortArgs(
            port = 80,
            protocol = azurenative.containerinstance.enums.ContainerGroupNetworkProtocol.TCP
          )
        )
      )
    )
  )

  Stack.exports(
    ipAddress = containerGroup.ipAddress.ip
  )
}

Stack trace:

Diagnostics:
  pulumi:pulumi:Stack (azure-aci-bootzooka-dev):
    Compiling project (Scala 3.3.1, JVM (21))
    Compiled project (Scala 3.3.1, JVM (21))
    Exception in thread "main" besom.internal.AggregatedDecodingError: Decoding Errors [2]:
      bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress: Encountered an error when deserializing an option
      bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress: Encountered an error when deserializing an option
    (with aggregate stack trace)
        at besom.internal.AggregatedDecodingError$.apply(codecs.scala:99)
        at besom.internal.ResourceDecoder$.besom$internal$ResourceDecoder$$anon$1$$_$$anonfun$14$$anonfun$1(ResourceDecoder.scala:111)
        at besom.internal.Result.flatMap$$anonfun$1(Result.scala:164)
        at besom.internal.Result.runM$$anonfun$7(Result.scala:269)
        at besom.internal.Runtime.flatMapBothM$$anonfun$1$$anonfun$1(Result.scala:118)
        at besom.internal.FutureRuntime.flatMapBoth$$anonfun$1(Result.scala:372)
        at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:477)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
    Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress: Encountered an error when deserializing an option
        at besom.internal.DecodingError$.apply(codecs.scala:80)
        at besom.internal.Decoder$.besom$internal$Decoder$$anon$7$$_$decode$$anonfun$3$$anonfun$3(codecs.scala:250)
        at besom.util.NonEmptyVector.map(Validated.scala:167)
        at besom.util.Validated.lmap(Validated.scala:47)
        at besom.util.Validated$.lmap$$anonfun$1(Validated.scala:137)
        at besom.internal.Result.map$$anonfun$1(Result.scala:201)
        ... 11 more
        Suppressed: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress: Encountered an error when deserializing an option
                at besom.internal.DecodingError$.apply(codecs.scala:80)
                at besom.internal.Decoder$.besom$internal$Decoder$$anon$7$$_$decode$$anonfun$3$$anonfun$3(codecs.scala:250)
                at scala.collection.immutable.Vector1.map(Vector.scala:1911)
                at scala.collection.immutable.Vector1.map(Vector.scala:377)
                ... 15 more
        Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.fqdn] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.fqdn: Encountered an error - possible secret - Known(Set(),false,Some(Value(NullValue(NULL_VALUE),UnknownFieldSet(Map()))))
                at besom.internal.DecodingError$.apply(codecs.scala:80)
                at besom.internal.Decoder.decode$$anonfun$1$$anonfun$2(codecs.scala:132)
                at besom.util.NonEmptyVector.map(Validated.scala:167)
                at besom.util.Validated.lmap(Validated.scala:47)
                at besom.internal.Decoder.decode$$anonfun$1(codecs.scala:134)
                at besom.util.Validated$.flatMap$$anonfun$1(Validated.scala:112)
                ... 11 more
        Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.fqdn] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.fqdn: Expected a string, got: 'NullValue(NULL_VALUE)'
                at besom.internal.DecodingError$.apply(codecs.scala:80)
                at besom.internal.Decoder$stringDecoder$.mapping(codecs.scala:202)
                at besom.internal.Decoder.decode$$anonfun$1$$anonfun$1(codecs.scala:128)
                at besom.internal.OutputData.traverseValidated(OutputData.scala:93)
                at besom.internal.Decoder.decode$$anonfun$1(codecs.scala:128)
                ... 12 more
    Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope: Encountered an error - possible secret - Known(Set(),false,Some(Value(NullValue(NULL_VALUE),UnknownFieldSet(Map()))))
        at besom.internal.DecodingError$.apply(codecs.scala:80)
        at besom.internal.Decoder.decode$$anonfun$1$$anonfun$2(codecs.scala:132)
        at besom.util.NonEmptyVector.map(Validated.scala:167)
        at besom.util.Validated.lmap(Validated.scala:47)
        at besom.internal.Decoder.decode$$anonfun$1(codecs.scala:134)
        at besom.util.Validated$.flatMap$$anonfun$1(Validated.scala:112)
        ... 11 more
    Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope: Expected a string, got: 'NullValue(NULL_VALUE)'
        at besom.internal.DecodingError$.apply(codecs.scala:80)
        at besom.internal.Decoder$stringDecoder$.mapping(codecs.scala:202)
        at besom.internal.Decoder.decode$$anonfun$1$$anonfun$1(codecs.scala:128)
        at besom.internal.OutputData.traverseValidated(OutputData.scala:93)
        at besom.internal.Decoder.decode$$anonfun$1(codecs.scala:128)
        ... 12 more

    2024.04.03 07:29:42:289 main  ERROR besom.internal.BesomModule.run:69
        besom.internal.AggregatedDecodingError: Decoding Errors [2]:
          bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress: Encountered an error when deserializing an option
          bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress: Encountered an error when deserializing an option
        (with aggregate stack trace)
                at besom.internal.AggregatedDecodingError$.apply(codecs.scala:99)
                at besom.internal.ResourceDecoder$.besom$internal$ResourceDecoder$$anon$1$$_$$anonfun$14$$anonfun$1(ResourceDecoder.scala:111)
                at besom.internal.Result.flatMap$$anonfun$1(Result.scala:164)
                at besom.internal.Result.runM$$anonfun$7(Result.scala:269)
                at besom.internal.Runtime.flatMapBothM$$anonfun$1$$anonfun$1(Result.scala:118)
                at besom.internal.FutureRuntime.flatMapBoth$$anonfun$1(Result.scala:372)
                at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:477)
                at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
                at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
                at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
                at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
                at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
                at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
        Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress: Encountered an error when deserializing an option
                at besom.internal.DecodingError$.apply(codecs.scala:80)
                at besom.internal.Decoder$.besom$internal$Decoder$$anon$7$$_$decode$$anonfun$3$$anonfun$3(codecs.scala:250)
                at besom.util.NonEmptyVector.map(Validated.scala:167)
                at besom.util.Validated.lmap(Validated.scala:47)
                at besom.util.Validated$.lmap$$anonfun$1(Validated.scala:137)
                at besom.internal.Result.map$$anonfun$1(Result.scala:201)
                at besom.internal.Result.flatMap$$anonfun$1(Result.scala:164)
                at besom.internal.Result.runM$$anonfun$7(Result.scala:269)
                at besom.internal.Runtime.flatMapBothM$$anonfun$1$$anonfun$1(Result.scala:118)
                at besom.internal.FutureRuntime.flatMapBoth$$anonfun$1(Result.scala:372)
                at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:477)
                at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
                at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
                at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
                at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
                at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
                at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
        Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope: Encountered an error - possible secret - Known(Set(),false,Some(Value(NullValue(NULL_VALUE),UnknownFieldSet(Map()))))
                at besom.internal.DecodingError$.apply(codecs.scala:80)
                at besom.internal.Decoder.decode$$anonfun$1$$anonfun$2(codecs.scala:132)
                at besom.util.NonEmptyVector.map(Validated.scala:167)
                at besom.util.Validated.lmap(Validated.scala:47)
                at besom.internal.Decoder.decode$$anonfun$1(codecs.scala:134)
                at besom.util.Validated$.flatMap$$anonfun$1(Validated.scala:112)
                at besom.internal.Result.flatMap$$anonfun$1(Result.scala:164)
                at besom.internal.Result.runM$$anonfun$7(Result.scala:269)
                at besom.internal.Runtime.flatMapBothM$$anonfun$1$$anonfun$1(Result.scala:118)
                at besom.internal.FutureRuntime.flatMapBoth$$anonfun$1(Result.scala:372)
                at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:477)
                at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
                at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
                at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
                at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
                at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
                at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
        Caused by: besom.internal.DecodingError: [bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope] bootzooka-container-group[azure-native:containerinstance:ContainerGroup].ipAddress.autoGeneratedDomainNameLabelScope: Expected a string, got: 'NullValue(NULL_VALUE)'
                at besom.internal.DecodingError$.apply(codecs.scala:80)
                at besom.internal.Decoder$stringDecoder$.mapping(codecs.scala:202)
                at besom.internal.Decoder.decode$$anonfun$1$$anonfun$1(codecs.scala:128)
                at besom.internal.OutputData.traverseValidated(OutputData.scala:93)
                at besom.internal.Decoder.decode$$anonfun$1(codecs.scala:128)
                at besom.util.Validated$.flatMap$$anonfun$1(Validated.scala:112)
                at besom.internal.Result.flatMap$$anonfun$1(Result.scala:164)
                at besom.internal.Result.runM$$anonfun$7(Result.scala:269)
                at besom.internal.Runtime.flatMapBothM$$anonfun$1$$anonfun$1(Result.scala:118)
                at besom.internal.FutureRuntime.flatMapBoth$$anonfun$1(Result.scala:372)
                at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:477)
                at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
                at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
                at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
                at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
                at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
                at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
@pawelprazak pawelprazak self-assigned this Apr 3, 2024
@pawelprazak pawelprazak added the area/core The SDK's core code label Apr 3, 2024
@lbialy
Copy link
Collaborator

lbialy commented Apr 3, 2024

This is an upstream problem (in azure-native) that bubbles up to us. Do you need the value of the ip address? If so, the only way to deal with this is to fix upstream. Our serde layer is lazy (on purpose) so if you don't use a property that fails on deserialization it won't crash your program.

@pawelprazak
Copy link
Collaborator

Thank you @polkx for the report. Looks like the underlying cause is two-fold:

  1. field fqdn is required and type of string, we get the protobuf's NULL_VALUE - this is provider breaking its contract
  2. field autoGeneratedDomainNameLabelScope is optional with a default and we mistakenly generate the provider code where the field is not optional - this is besom codegen bug.

The reason why ipAddress = containerGroup.ipAddress.ip is the bug trigger is because besom is trying to be smart about deserialization, and it is done when needed - so until someone accesses the filed witl broken value from the provider, then the problem does not propagate. Since this problem is widely spread among pulumi providers (of unexpected null values) then this should be helpful.

A separate discussion is whether or not, adding an "escape hatch", like a `recover function proposed by @lbialy would be helpful to the user. As pointed out by Łukasz, due to the fact that te user has limited possibilities how to remediate such a problem, the usefulness of such escape hatch would be limited.

For the reference, the schema from upstream defines the ipAddress as:

"azure-native:containerinstance:IpAddressResponse": {
            "description": "IP address for the container group.",
            "properties": {
                "autoGeneratedDomainNameLabelScope": {
                    "type": "string",
                    "description": "The value representing the security enum. The 'Unsecure' value is the default value if not selected and means the object's domain name label is not secured against subdomain takeover. The 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the same tenant. The 'SubscriptionReuse' value means the object's domain name label can be reused within the same subscription. The 'ResourceGroupReuse' value means the object's domain name label can be reused within the same resource group. The 'NoReuse' value means the object's domain name label cannot be reused within the same resource group, subscription, or tenant.",
                    "default": "Unsecure"
                },
                "dnsNameLabel": {
                    "type": "string",
                    "description": "The Dns name label for the IP."
                },
                "fqdn": {
                    "type": "string",
                    "description": "The FQDN for the IP."
                },
                "ip": {
                    "type": "string",
                    "description": "The IP exposed to the public internet."
                },
                "ports": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "$ref": "#/types/azure-native:containerinstance:PortResponse"
                    },
                    "description": "The list of ports exposed on the container group."
                },
                "type": {
                    "type": "string",
                    "description": "Specifies if the IP is exposed to the public internet or private VNET."
                }
            },
            "type": "object",
            "required": [
                "fqdn",
                "ports",
                "type"
            ]
        },

besom azure native code:

final case class ContainerGroup private( 
  ...
  ipAddress: besom.types.Output[scala.Option[besom.api.azurenative.containerinstance.outputs.IpAddressResponse]],
  ...
) extends besom.CustomResource
final case class IpAddressResponse private(
  autoGeneratedDomainNameLabelScope: String, // should be optional
  dnsNameLabel: scala.Option[String],
  fqdn: String, // is correct
  ip: scala.Option[String],
  ports: scala.collection.immutable.List[besom.api.azurenative.containerinstance.outputs.PortResponse],
  `type`: String
)

pulumi TS azure native:

    export interface IpAddressResponse {
        autoGeneratedDomainNameLabelScope?: string; // <<<
        dnsNameLabel?: string;
        fqdn: string; // <<<
        ip?: string;
        ports: outputs.containerinstance.PortResponse[];
        type: string;
    }

@pawelprazak pawelprazak added this to the 0.3.0 milestone Apr 3, 2024
@pawelprazak pawelprazak added the kind/bug Some behavior is incorrect or out of spec label Apr 4, 2024
@pawelprazak pawelprazak changed the title Can't get ipAddress field from azurenative.containerinstance.ContainerGroup Can't get ipAddress field from azurenative.containerinstance.ContainerGroup Apr 4, 2024
@pawelprazak
Copy link
Collaborator

This is what we get from the engine:

    Value(
      kind = StructValue(
        value = Struct(
          fields = Map(
            "ip" -> Value(kind = StringValue(value = "4.157.146.145")),
            "ports" -> Value(
              kind = ListValue(
                value = ListValue(
                  values = Vector(
                    Value(
                      kind = StructValue(
                        value = Struct(
                          fields = Map(
                            "port" -> Value(kind = NumberValue(value = 8080.0)),
                            "protocol" -> Value(kind = StringValue(value = "TCP"))
                          )
                        )
                      )
                    )
                  )
                )
              )
            ),
            "type" -> Value(kind = StringValue(value = "Public"))
          )
        )
      )

As visible above, the ip that was accessed in the beginning, is present, and the errors are regarding neighboring fields.

The behavior I would expect is:

  1. when accessing only the ip field - no error
  2. when accessing the entire ipAddress - all errors regarding any of its fields

The question is, how can we do it, and how feasible is this.

@lbialy
Copy link
Collaborator

lbialy commented Apr 4, 2024

Wait, this is an output type of struct, right? The property of a resource is an output of a case class that belongs to outputs package in codegened code? I thought that you meant that it's a property on a resource! If it's a field on a case class that's an output struct we can't do anything about it without breaking the type system. Let me elaborate - let's say we have:

case class SomeProps(a: String, b: Int, c: Double)
case class SomeResource(name: Output[String], props: Output[SomeProps])

Now in serde layer we have a resource decoder that will look up decoder instances for all fields in SomeResource and it will find List(Decoder[String], Decoder[SomeProps]). What we get from gRPC for the props field, for brevity in JSON form, is:

{
  "a": "some string",
  "b": 23
}

Notice the missing value for c field! Given that the definition of SomeProps case class expects non-nullable String, Int and Double there's literally nothing we can do to satisfy this expectation if we have a String and an Int only short of pushing a null into the c: Double position. That is subversion of the type system and as such is strictly against our philosophy of not lying in types.

The only other thing we could do here is to replace all the case classes of the output-kind of structs with wrappers extending Selectable over Maps with type refinements to allow safe, inline-based access to the properties held inside like @prolativ proposed to solve bincompat issues. This would break any support in Intellij because it's unable to comprehend type refinements at all and would force us to write an Intellij plugin for Besom. This solution would also throw on missing values but given that it always happens in Outputs and is literally how we currently work with such defects it would keep the status quo but improve the situation with deeply nested missing or broken props (because it would be possible to defer errors until access to a broken field happens).

Other than that (and that's not really feasible given the Intellij problem) there's not much we can do beside complaining to the upstream to get their stuff fixed.

We've had a discussion regarding hotfixes on our side that would patch schema during codegen before and you were against this. Such a hotfix to schema would allow us to mark this field as optional, codegenerate the case class with Option field and then our decoders would work without any issues.

@pawelprazak
Copy link
Collaborator

pawelprazak commented Apr 5, 2024

You are right, since output classes does not have Output properties, we cannot defer the error to the last minute.

The easiest solution in my opinion would be to have output classes with output fields, then we'd have the granularity we need in regard to decoder errors. Since we already return Resources as outputs and we have a lot of lifts and other helpers to deal with outputs, this should not be that big of an issues, or am I missing something obvious, WDYT @lbialy?

Regarding other possibilities:

... extending Selectable over Maps with type refinements ...

I'd have to dig deeper into this proposal to fully understand all the implications, but I trust your judgment and from what you're saying I'm having mixed feelings about this one, I'm not against thou, just worried about consequences to the DX.

... complaining to the upstream to get their stuff fixed

Yes, this is always an options, unfortunately, I'd be surprised if this type of issue would get high priority, since all other SDK choose to deal with this by hiding the problem.

... patch schema during codegen before and you were against this

Yes, my main concern with schema patching is the scalability of maintenance, this would be fine with big enough community thou, but that's a bit of a chicken and the egg situation

... mark this field as optional ...

This would effectively turn every field into optional field, because if we cannot rely on the provider to conform to its schema then we have to assume that everything is optional, and this does not sound user friendly at all to me

@pawelprazak
Copy link
Collaborator

There's one more consideration, the secretness. @polkx has made me aware that, when one of the fields in output class is secret, then the Output of the whole output class is secret, effectively making every field secret, regardless of the underlying schema. Making every field an output would solve this issue as well.

@lbialy lbialy modified the milestones: 0.3.0, 0.4.0 Apr 9, 2024
@pawelprazak
Copy link
Collaborator

Until we re-architecture the output classes, I'd like to put under consideration the addition of Output.recover to allow for workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core The SDK's core code kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants