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

Seemingly dangling type reference to aRN:ARN #1682

Closed
t0yv0 opened this issue Nov 1, 2021 · 3 comments
Closed

Seemingly dangling type reference to aRN:ARN #1682

t0yv0 opened this issue Nov 1, 2021 · 3 comments
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed

Comments

@t0yv0
Copy link
Member

t0yv0 commented Nov 1, 2021

Hello!

  • Vote on this issue by adding a 👍 reaction
  • To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)

Issue details

Currently schema.json contains the following construcs:

      "$ref": "#/types/aws:index/aRN:ARN",

But there is no corresponding entry in .types, so this is a dangling reference. In addition these constructs happen to be used in addition to "type": "string" which seems suspect.

Steps to reproduce

  jq '.resources["aws:datasync/efsLocation:EfsLocation"]' provider/cmd/pulumi-resource-aws/schema.json

  ...
  
  "inputProperties": {
    "efsFileSystemArn": {
      "type": "string",
      "$ref": "#/types/aws:index/aRN:ARN",
      "description": "Amazon Resource Name (ARN) of EFS File System.\n"
    },

Expected: no dangling ref, either string or ref
Actual: string and dangling ref

@t0yv0 t0yv0 added the kind/bug Some behavior is incorrect or out of spec label Nov 1, 2021
@stack72
Copy link
Contributor

stack72 commented Nov 2, 2021

@t0yv0 this was added by @pgavlin in #991

via the following code:

			"aws_datasync_location_efs": {
				Tok: awsResource(datasyncMod, "EfsLocation"),
				Fields: map[string]*tfbridge.SchemaInfo{
					"efs_file_system_arn": {Type: awsTypeDefaultFile(awsMod, "ARN")},
				},
			},

Notice awsTypeDefaultFile which does the following:

func awsTypeDefaultFile(mod string, typ string) tokens.Type {
	fn := string(unicode.ToLower(rune(typ[0]))) + typ[1:]
	return awsType(mod, fn, typ)
}

This means we could have been carrying this for quite a while - or maybe this is the intended behaviour?

thoughts?

@t0yv0
Copy link
Member Author

t0yv0 commented Nov 2, 2021

Thanks for looking that up! Yes, it might be intended. I do not think it is doing any real harm now just odd corner cases here and there. I stumbled on it when working on programgen for $fn.Output forms, but eventually concluded it's a broader unrelated issue with dangling imports being generated:

pulumi/pulumi#8324

Then I got a workaround in my PR so I can proceed.

For I just would like to clarify and document intent behind this aRN:ARN. I would also like to check why pulumi schema check accepts this. It seems like schema should not validate, and dangling references should be made prominent.

@mikhailshilkov mikhailshilkov added the resolution/by-design This issue won't be fixed because the functionality is working as designed label Nov 1, 2023
@mikhailshilkov
Copy link
Member

This is largely by design. Broader discussion in #2565 - so I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed
Projects
None yet
Development

No branches or pull requests

3 participants