Skip to content

Conversation

@thevilledev
Copy link
Contributor

  • Introduce a new PathAwareParser interface that extends Parser with SetPath(path string).
  • Update parseConfigurations to detect if a parser implements PathAwareParser, and call SetPath(path).
  • Implement SetPath in the Jsonnet parser, setting the JPath (library path) to the file’s directory.
  • Add tests to ensure that relative imports in Jsonnet now work as expected.

Fixes #939

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just need the conflicts resolved

- Introduce a new `PathAwareParser` interface that extends `Parser` with `SetPath(path string)`.
- Update `parseConfigurations` to detect if a parser implements `PathAwareParser`, and call `SetPath(path)`.
- Implement `SetPath` in the Jsonnet parser, setting the JPath to the file’s directory.
- Add tests to ensure that relative imports in Jsonnet now work as expected.

Signed-off-by: Ville Vesilehto <[email protected]>
@thevilledev thevilledev force-pushed the fix/jsonnet-library-imports branch from bdf272f to aa9e3c8 Compare January 31, 2025 18:41
@anderseknert anderseknert merged commit 326a1a4 into open-policy-agent:master Jan 31, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jsonnet parser cannot handle relative imports

2 participants