"bump overlay" should log a warning when JSONPath doesn't match anything
- Dominant language
- TypeScript
- Stars
- 71
- Forks
- 9
- Avg merge
- 7m
- Merged PRs (30d)
- 4
Description
When writing JSONPath expressions, it's common to make mistakes where the expression is syntactically valid but matches nothing. Currently `bump overlay` just silently ignores such targets, which complicates troubleshooting.
It would be nice if the tool could warn the user about such noop targets. These warnings could be either always on, or enabled by some flag. For example [`speakeasy overlay apply`](https://www.speakeasy.com/docs/speakeasy-cli/overlay/apply) has the `--strict` flag for this purpose.
Some common errors:
1. Typos in node names, values, filters:
```
$..parameters[?( @.name == 'fron_date' )]
$..paramaters[?( @.name == 'from_date' )]
$.servers[?( @.desciption == 'Dev' )]
```
2. Skipping nodes in a path:
```yaml
- target: $.components.schemas.SchemaName.propName # should be: ...SchemaName.properties.propName
update:
description: something
example: 123
```
3. Extra nodes in a path:
```yaml
$.paths.*[?( @.operationId == 'get_foo' )].get # '.get' is not needed here
```
5. Consider an overlay that targets an endpoint by its path or `operationId`:
```yaml
$.paths['/foos/{id}'].get
$.paths.*[?( @.operationId == 'get_foo' )]
```
Later this endpoint gets renamed (e.g. `/foos/{id}` becomes `/foos/{foo_id}`) or its `operationId` gets changed (e.g. maybe op IDs are autogenerated and the algorithm changes).
As an overlay author and maintainer, I would like to get notified about non-matches so that I can update the overlay to match the current state of my API.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.