Skip to content

"bump overlay" should log a warning when JSONPath doesn't match anything #588

@hkosova

Description

@hkosova

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 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:

    - target: $.components.schemas.SchemaName.propName   # should be: ...SchemaName.properties.propName
      update:
        description: something
        example: 123
  3. Extra nodes in a path:

    $.paths.*[?( @.operationId == 'get_foo' )].get   # '.get' is not needed here
  4. Consider an overlay that targets an endpoint by its path or operationId:

    $.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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions