Skip to content

Instantly share code, notes, and snippets.

@elfsternberg
Created January 6, 2026 15:54
Show Gist options
  • Select an option

  • Save elfsternberg/3f63abc874c605de0b26208188f6224c to your computer and use it in GitHub Desktop.

Select an option

Save elfsternberg/3f63abc874c605de0b26208188f6224c to your computer and use it in GitHub Desktop.
Shortcut Files
# From an OpenAPI Schema, extract all the schemas as an array of key/value pairs (to_entries converts them back
# key/value pairs, and the `.[]` expression re-array-ifies them), get the properties of each schema and count them,
# and report them in count: schema-name order; sort by the count; reverse the count so the smallest schemas are
# toward the bottom
$ yq '.components.schemas | to_entries | .[] | (.value.properties | length) + ": " + .key' schema.yml | sort -n | tac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment