Skip to content

Improve Import Error Message When Failure Originates from a Transitive Import #1653

@bmarcaur

Description

@bmarcaur

From an internal slack discussion:

> Task :module-api:rawIr FAILED
Encountered error trying to parse file '/Volumes/git/repo/module-api/build/conjure/Service.yml'
Import not found for namespace: Namespace{name=othernamespace}

the actual import failure was while parsing a file imported by Service.yml, not in Service.yml itself (but it was particularly confusing because othernamespace was imported into Service.yml as well).

Here is a simple example of the issue:

# Service.yaml
types:
  conjure-imports:
    othernamespace: ./other-import.yml
    transitive: ./transitive-import.yml
  definitions:
    objects:
      OtherThing: othernamespace.thing
      TransitiveThing: transitive.thing
# transitive-import.yml
types:
  # intentionally empty for example, but should have:
  # othernamespace: ./other-import.yml
  conjure-imports: []
  definitions:
    objects:
      # references a namespace that is not declared, but is declared in the parent
      OtherThing: othernamespace.thing

The error message should more accurately reflect the enclosing file that failed to import.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions