Skip to content

Instantly share code, notes, and snippets.

@ehvattum
Last active April 7, 2021 09:54
Show Gist options
  • Save ehvattum/4e9041da47b6fe786276d796d8be8eb0 to your computer and use it in GitHub Desktop.
Save ehvattum/4e9041da47b6fe786276d796d8be8eb0 to your computer and use it in GitHub Desktop.
Requires jq. Strips example data from swagger/openapi specifications in json format. Useful if the example data contains constant changing data like dynamic dates.
jq 'walk(if type == "object" then del(.examples) | del(.example) else . end)' < spec-with-examples.json > spec-without-examples.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment