Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hkosova opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@hkosova
Copy link

hkosova commented Nov 8, 2024

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.

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

No branches or pull requests

1 participant