Skip to content

feat: support Swagger 2.0 sources - #15

Merged
includeamin merged 7 commits into
mainfrom
swagger2-support
Nov 21, 2026
Merged

includeamin merged 7 commits into
mainfrom
swagger2-support

Conversation

@includeamin

Copy link
Copy Markdown
Owner

Summary

  • Swagger 2.0 sources (swagger: "2.x", JSON or YAML) are now converted to OpenAPI 3.0.3 before merging instead of being rejected. Swagger 1.x is still rejected with a clear error.
  • New pure swagger2 module in openapi-aggregator-core (no new dependencies, still wasm-compatible), so the CLI, the library and the playground behave identically.
  • Conversion is lenient and never fails on odd input. Anything approximated or dropped is reported as a warning prefixed with the source name, e.g. source 'legacy': collectionFormat 'tsv' is not supported in OpenAPI 3; dropped.
  • additional_blocks are applied after conversion, so they are written in 3.x shape.
  • New prepare_source_with_notes / PreparedSource API; prepare_source keeps its signature.
  • Playground: new "Swagger 2.0 + OpenAPI 3" example; conversion notes show up in the problems panel as warnings.

What is converted

host/basePath/schemes to servers; definitions/parameters/responses to components with $ref rewriting (including discriminator.mapping); consumes/produces to media types (operation overrides root); in: body and in: formData to requestBody (multipart when files are involved); non-body parameters to schema, with collectionFormat mapped to style/explode; response schema, headers and examples; securityDefinitions including OAuth2 flows; type: file, x-nullable and string discriminator.

Test plan

  • cargo test --workspace (unit tests per conversion rule, Swagger Petstore 2.0 fixture, 2.0 + 3.x merge with rename where every $ref resolves, wasm warning test)
  • cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check
  • cd web && npm test and npm run e2e

@includeamin
includeamin merged commit 09af17d into main Nov 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant