Add Swagger 2.0 support and custom spec URL for api cloud by jeremybeard · Pull Request #2040 · astronomer/astro-cli

@jeremybeard

@jeremybeard @claude

- Add Swagger 2.0 (OpenAPI 2.x) parsing support alongside existing
  OpenAPI 3.x. The spec version is auto-detected and the appropriate
  model is built. Swagger 2.0 body parameters are converted to
  RequestBody and responses are mapped with synthetic content types.
- Add --spec-url flag on `astro api cloud` to override the default
  Cloud API spec URL. The base URL for requests is derived from the
  spec's servers/basePath combined with the current context domain.
- Add --spec-token-env-var flag to provide an env var name containing
  an auth token for fetching specs that require authentication.
- Add GetServerPath() to extract the API base path from either v3
  servers[0].url or v2 basePath.
- Fix circular $ref stack overflow in schema conversion by returning
  ref names without resolving into BuildSchema().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@jeremybeard marked this pull request as ready for review

March 19, 2026 14:30