I have a property which is a reference to a type f...
# package-authoring
l
I have a property which is a reference to a type from the AWS package:
Copy code
encryptionConfigurations:
        type: array
        items:
          "$ref": /aws/v6.65.0/schema.json#/types/aws:ecr%2FRepositoryEncryptionConfiguration:RepositoryEncryptionConfiguration
        description: 'Encryption configuration for the repository. See below for schema.'
        willReplaceOnChanges: true
If I generate a NodeJS SDK using a schema with that in it, it renders to
Copy code
import {RepositoryEncryptionConfiguration} from "RepositoryEncryptionConfiguration";
which isn't valid
e
I was curious so I tried adding this to an existing provider and I get valid TypeScript code generated and valid imports (it compiles) e.g.:
Copy code
/**
     * Encryption configuration for the repository. See below for schema.
     */
    encryptionConfigurations?: pulumi.Input<pulumi.Input<pulumiAws.types.input.ecr.RepositoryEncryptionConfiguration>[]>;
Could you isolate a repro and send to
pulumi/pulumi
? Sounds important to fix.
l
Interesting - I'll see if I can do that. Just to confirm, there isn't a typo in my ref or anything right?
(presumably you copied+pasted?)
e
I think I copied your prop verbatim. Could be different issues of code generator?
l
I'm on 3.144.1. I've just created an incredibly minimal schema, does this look correct to you, and if it does, could you try it? I still get the same behaviour
Copy code
name: 'echobox'
resources:
  echobox:ecr:repository:
    properties:
      encryptionConfigurations:
        type: array
        items:
          "$ref": "#/types/aws:ecr%2FRepositoryEncryptionConfiguration:RepositoryEncryptionConfiguration"
      imageScanningConfiguration:
        "$ref": "#/types/aws:ecr%2FRepositoryImageScanningConfiguration:RepositoryImageScanningConfiguration"
Could this be related to the fact my schema is YAML? Most packages use JSON, so I'm curious if this is some issue with the
%2F
url encode
e
How are you trying it?
pulumi gen-sdk
?
l
yeah
Copy code
pulumi package gen-sdk ./schema.yaml --language nodejs
e
you mean
Copy code
name: 'echobox'
resources:
  echobox:ecr:repository:
    properties:
      encryptionConfigurations:
        type: array
        items:
          "$ref": "/aws/v6.65.0/schema.json#/types/aws:ecr%2FRepositoryEncryptionConfiguration:RepositoryEncryptionConfiguration"
      imageScanningConfiguration:
        "$ref": "/aws/v6.65.0/schema.json#/types/aws:ecr%2FRepositoryImageScanningConfiguration:RepositoryImageScanningConfiguration"
right? the
#/types/
syntax is going to look for a locally defined type, and not find one. Looks like instead of failing right away it generates some nonsense though that looks like a problem.
l
oh my god I'm an idiot
e
Happy holidays! It happens, Pulumi should have had better error messages. I'll file a quick ticket.
l
I added
/aws/v6.65.0/schema.json
to stateInputs and inputProperties but forgot to update the ones in
properties
. It just so happens my minimal reproduction attempt copied the ones from properties 🤦‍♂️ Thank you very much!
e
https://github.com/pulumi/pulumi/issues/18120 FWIW, we'll get to it at some point.