Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/codspeed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CodSpeed

on:
push:
branches: [main]
pull_request:
branches: [main]
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6

- run: pnpm i

- uses: CodSpeedHQ/action@v4
with:
mode: simulation
run: pnpm run bench
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<a href="https://www.npmjs.com/package/@openapi-spec/types">
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40openapi-spec%2Ftypes?logo=npm" />
</a>
<a href="https://app.codspeed.io/middleapi/openapi-spec?utm_source=badge">
<img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed" />
</a>
<a href="https://github.com/middleapi/openapi-spec/blob/main/LICENSE">
<img alt="MIT License" src="https://img.shields.io/github/license/middleapi/openapi-spec?logo=open-source-initiative" />
</a>
Expand All @@ -32,6 +35,7 @@ pnpm install
pnpm test
pnpm lint
pnpm type:check
pnpm bench
```

## Sponsors
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
"type:check": "pnpm run -r type:check && tsc",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"bench": "vitest bench --run",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"repo:fix": "sherif --fix",
"sync:sponsors": "node scripts/sync-sponsors.ts && eslint --fix '**/README.md'"
},
"devDependencies": {
"@antfu/eslint-config": "^9.5.1",
"@codspeed/vitest-plugin": "^5.7.1",
"@seriousme/openapi-schema-validator": "^2.9.1",
"@types/node": "^26.4.0",
"@vitest/coverage-v8": "^4.1.11",
Expand Down
9 changes: 9 additions & 0 deletions packages/downgrader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<a href="https://www.npmjs.com/package/@openapi-spec/downgrader">
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40openapi-spec%2Fdowngrader?logo=npm" />
</a>
<a href="https://app.codspeed.io/middleapi/openapi-spec?utm_source=badge">
<img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed" />
</a>
<a href="https://github.com/middleapi/openapi-spec/blob/main/LICENSE">
<img alt="MIT License" src="https://img.shields.io/github/license/middleapi/openapi-spec?logo=open-source-initiative" />
</a>
Expand Down Expand Up @@ -247,6 +250,12 @@ A schema is _loosened_ when the conversion removes a restriction from it or a su
- A schema without `type` that has `contentEncoding: base64`, or `contentMediaType` without `contentEncoding`, gains `type: string`, so non-string values the original accepts are rejected.
- Non-standard keywords are kept, although the official 3.0 schema forbids them.

## Performance

An object reached through many `$ref`s or shared references is converted once and reused, so the work grows with the size of the document, not with the number of paths through its references, even where they form cycles.

[Benchmarks](https://github.com/middleapi/openapi-spec/tree/main/packages/downgrader/benches) cover each converter on the official example documents, generated APIs, and worst-case reference graphs. [CodSpeed](https://app.codspeed.io/middleapi/openapi-spec) runs them on every pull request to catch regressions.

## Sponsors

Like what we build over at [middleapi](https://github.com/middleapi)? You can help keep it going through [GitHub Sponsors](https://github.com/sponsors/dinwwwh) or [Open Collective](https://opencollective.com/middleapi). Every bit helps! 🚀
Expand Down
Loading
Loading