google / google/go-jsonnet

Feature request - support for remote imports

Open
#432 8 comments 7 reactions 0 assignees View on GitHub
enhancement research
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

It would be great if Jsonnet could natively resolve remote imports, rather than be limited to `import`ing local files. In its current state, a user must use a workaround like defining all of their Jsonnet in a monorepo, or using a secondary tool like `jsonnet-bundler` or `vendir` to "vendor" the Jsonnet files locally first.

It would be great if we could extend [imports.go](https://github.com/google/go-jsonnet/blob/master/imports.go) to support remote imports. This could either be an extension of the default `FileImporter` and it's associated functions, or a new importer type. Extending the default importer would be preferred since it's [the default importer](https://github.com/google/go-jsonnet/blob/master/cmd/jsonnet/cmd.go#L454) in `cmd.go` today, otherwise users would have to change that one line and maintain their own fork/build.

I started working on a quick-and-dirty [implementation](https://github.com/google/go-jsonnet/pull/431) for resolving imports over HTTP, but this became very GitHub-specific once I added auth support. I'd be happy to develop this feature and submit a PR, but I'm hoping the maintainers could provide feedback on (a) whether you support/reject the concept of remote imports in general and (b) preferences on protocol (HTTP vs git vs other) before I invested more time in this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.