quaint-spring-93350
10/27/2023, 1:41 PM<package>:<module>:<typename>
(we implement this and fail validation at compile time if string doesn't match this pattern) and <package>:<typename>
where this implies <package>:index:<typename>
(we don't support this yet, hence the discussion). Introspection into your code and into codegen integration tests suggests that actually supported shorthand pattern is not <package>:<typename>
but <package>::<typename>
with empty module segment. This is further corroborated by metaschema here: https://github.com/pulumi/pulumi/blob/master/developer-docs/providers/metaschema.md#token which suggests this regex: ^[a-zA-Z][-a-zA-Z0-9_]*:([^0-9][a-zA-Z0-9._/-]*)?:[^0-9][a-zA-Z0-9._/]*$
which also allows x:y:z
and x::z
but not x:z
. Is documentation misguided here?echoing-dinner-19531
10/30/2023, 3:35 PM<package>::<typename>
will cause inconsistencies in other parts of the system so that definitely can't be the right answer here! Having said that, it wouldn't surprise me if parts of the system were trying to do that and just resulting in slightly incorrect answers that hadn't been picked up on.
The metaschema and token validation are broken if they're accepting "pkg::typ" but not "pkg:typ". I'll dig in and see if we can straighten this out. I've been looking into this area this week anyway (e.g. https://github.com/pulumi/pulumi/pull/14441 to check that "::" isn't used in component type names)quaint-spring-93350
10/31/2023, 9:42 AM<package>::<typename>
is exactly what works and is implemented in the core 😱echoing-dinner-19531
10/31/2023, 11:32 AMquaint-spring-93350
10/31/2023, 12:48 PM<package>:<module>:<typename>
or <package>:<typename>
where this implies <package>:index:<typename>
, right? I think if you introduce this change now a lot of stuff will break on your side. For instance, we have just ported integration tests for codegen to failproof it and check what's missing and I think most of those tests use this format: "mypkg::Resource"
.[error] A component resource must register a unique type name with the base constructor, for example: `pkg:index:MyComponent`.
[error] To reduce the potential of other type name conflicts, this name contains the package and module name, in addition to the type: <package>:<module>:<type>.
[error] These names are namespaced alongside non-component resources, such as `aws:lambda:Function`.
[error] ctx.registerResource[Resource, ResourceArgs]("mypkg::Resource", name, args, opts)
[error] ^^^^^^^^^^^^^^^^^
That's a compilation error, resource type strings are validated in compile time on our side and the error message is oriented towards end users because we assumed it's impossible for schemas to contain invalid resource types (and even if they did, we will get this error and understand what it means anyhow).echoing-dinner-19531
10/31/2023, 1:01 PM