Fetch OpenAPI Specification
Description
Use this skill when you need to look up details about the Oxide API, including:
- •Finding endpoint definitions, paths, or HTTP methods
- •Looking up schema/type definitions from the API spec
- •Understanding request/response formats for API operations
- •Investigating API changes or additions
- •Comparing generated code against the source OpenAPI spec
Instructions
- •
Read the
VERSION_OMICRONfile to get the Omicron commit hash - •
Check if a cached spec exists for this version:
bashtest -f /tmp/oxide-openapi-spec-{commit}.json && echo "cached"If the file exists, skip to step 5 - the spec is already cached. Report that the cached spec is being used.
- •
Use curl to get the symlink target (the versioned filename):
bashcurl -sL "https://raw.githubusercontent.com/oxidecomputer/omicron/{commit}/openapi/nexus/nexus-latest.json"The response body contains the versioned filename (e.g.,
nexus-2026010800.0.0-1844ae.json) - •
Download the actual OpenAPI spec:
bashcurl -sL "https://raw.githubusercontent.com/oxidecomputer/omicron/{commit}/openapi/nexus/{versioned-filename}" -o /tmp/oxide-openapi-spec-{commit}.json - •
Report what you found:
- •The Omicron commit version
- •Whether the spec was fetched fresh or loaded from cache
- •Confirm the spec is available at
/tmp/oxide-openapi-spec-{commit}.json
- •
The spec is now available at
/tmp/oxide-openapi-spec-{commit}.jsonfor further analysis
Optional Arguments
If the user provides arguments like:
- •
--endpoint <name>orendpoint <name>: Search for and display details about a specific endpoint - •
--schema <name>orschema <name>ortype <name>: Search for and display a specific schema/type definition - •
--search <term>: Search endpoints and schemas for the given term
Use jq or read the temp file to fulfill these queries.
Output Format
- •Default to YAML when displaying schemas or endpoint details (use
yqorjq ... | yq -P) - •Only use JSON or table format if the user explicitly requests it (e.g.,
--jsonor--table)
Notes
- •The spec is large (~2MB JSON), so summarize rather than output the entire thing
- •If fetching fails, suggest checking if VERSION_OMICRON contains a valid commit hash
- •Reference
internal/generate/main.go:getOpenAPISpecURLfor the canonical implementation