Skip to content

Conversation

@tonicospinelli
Copy link

@tonicospinelli tonicospinelli commented Oct 18, 2023

These changes reduce tricks some projects face to get proto import path dependencies when it depends on multiple resources in different paths.

Here is a snippet of how some projects use it:

find api/proto -name '*.proto' -print0 2>/dev/null | xargs -0 --no-run-if-empty -n 1 \
		api-linter --set-exit-status --config .api-linter.yml \
		$(sed -n -e '/roots:/,/:$/{s/^\s*- /-I /p}' buf.yaml)

or

find api/proto -name '*.proto' -print0 2>/dev/null | xargs -0 --no-run-if-empty -n 1 \
		api-linter --set-exit-status --config .api-linter.yml \
		-I import/path1 -I import/path2

Adding import_paths in the configuration file is helpful to centralize the api-linter directives. See:

- include_paths:
    - path_1/**/*.proto
  import_paths:
    - import/path

Using the above config file the command was pretty easy to use:

$ find api/proto -name '*.proto' -print0 2>/dev/null | xargs -0 --no-run-if-empty -n 1 \
		api-linter --set-exit-status --config .api-linter.yml

@quirogas
Copy link
Contributor

I'm closing this PR since it hasn't been addressed recently and we are preparing to release api-linter v2 (#1529). If you still wish to introduce this feature, please open a new issue in api-linter. Thank you!

@quirogas quirogas closed this Oct 21, 2025
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.

2 participants