Speakeasy Logo
Skip to Content

What are JSONPath Expressions?

JSONPath expressions provide a powerful tool for querying and manipulating JSON data in your OpenAPI specifications. By using JSONPath, you can selectively target specific nodes in your API spec and apply modifications without altering the base structure

Example JSONPath Expressions

All Post or Get Operations

This expression selects all paths that contain either POST or GET operations. It’s useful when you want to apply changes or add annotations specifically to these HTTP methods.

JSONPath Target

Overlay Action

Operations with a Request Body

This targets all operations that include a request body. It’s ideal for adding descriptions, examples, or additional schema validations to request bodies.

JSONPath Target

Overlay Action

Operations with a Specific Visibility Notation

This expression is used to find all operations marked with ‘admin’ visibility. It can be used to apply additional security measures or modify documentation for admin-only endpoints.

JSONPath Target

Overlay Action

Inject Annotations as Siblings

This expression targets all operations within an OpenAPI specification that have an operationId property.

JSONPath Target

Overlay Action

Last updated on