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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve non-existent field error message by checking if the field fits into the child object #560

Open
iwahbe opened this issue Mar 15, 2024 · 0 comments
Labels
area/expr Syntax, expressions, and functions in YAML kind/enhancement Improvements or new features

Comments

@iwahbe
Copy link
Member

iwahbe commented Mar 15, 2024

Hello!

  • Vote on this issue by adding a 馃憤 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Building on top of #559, we currently (correctly) error when user's specify an invalid property for an object. If the invalid field specified is valid in a directly nested object, we should suggest that the user nests it.

For example:

  service:
    type: gcp:cloudrun:Service
    properties:
      location: us-central1
      template:
        containers:
          - image: "gcr.io/cloudrun/hello"
    Error: Property containers does not exist on 'gcp:cloudrun/ServiceTemplate:ServiceTemplate'
      on Pulumi.yaml line 13:
      13:         containers:
      14:           - image: "gcr.io/cloudrun/hello"
    Cannot assign '{location: string, template: {containers: List<{image: string}>}}' to 'gcp:cloudrun/service:Service':      template: Cannot assign '{containers: List<{image: string}>}' to 'gcp:cloudrun/ServiceTemplate:ServiceTemplate':
        Existing properties are: metadata, spec

We should also suggest that containers is a property of spec:

    Error: Property containers does not exist on 'gcp:cloudrun/ServiceTemplate:ServiceTemplate'
      on Pulumi.yaml line 13:
      13:         containers:
      14:           - image: "gcr.io/cloudrun/hello"
    Cannot assign '{location: string, template: {containers: List<{image: string}>}}' to 'gcp:cloudrun/service:Service':      template: Cannot assign '{containers: List<{image: string}>}' to 'gcp:cloudrun/ServiceTemplate:ServiceTemplate':
        Existing properties are: metadata, spec
        'containers' is a property of 'spec': consider nesting 'containers' under 'spec':
        ```
          spec:
            containers:
              - image: "gcr.io/cloudrun/hello"
        ```

Affected area/feature

@iwahbe iwahbe added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Mar 15, 2024
@Frassle Frassle added area/expr Syntax, expressions, and functions in YAML and removed needs-triage Needs attention from the triage team labels Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/expr Syntax, expressions, and functions in YAML kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

2 participants