Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v9): backport openapi tooling etc. from v10 #1145

Merged
merged 17 commits into from
Jan 6, 2025

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Jan 6, 2025

kanadgupta and others added 10 commits January 6, 2025 14:44
## 🧰 Changes

fixing up a few oversights that fell through the cracks! will backport
these changes to v9 once this is merged.
## 🧰 Changes

updating our contrib docs to reflect our new release process and
guidance for writing commands in an `oclif`-friendly way.
some cruft cleanup that fell through the cracks when removing `rdme
open` and `rdme openapi`. also cleaning up a minor README oversight
This upgrades our [oas](https://npm.im/oas) and
[oas-normalize](https://npm.im/oas-normalize) tooling to their latest
releases. Included in this work are a couple new features to and
refactors to some commands:

The `.validate()` call within `oas-normalize` has been refactored to no
longer do conversion and validation, the conversion side has been split
off to a new `.convert()` method.

As part of this change the previous `convertToLatest` parameter that
`.validate()` accepted for converting Swagger definitions to OpenAPI no
longer exists anywhere. We had this configurable within some internal
methods within rdme but it was never exposed, and converting Swagger to
OpenAPI has always been the default behavior throughout rdme.

Our analyzer tool can now surface information on if an API definition
utilizes common parameters.[^1]

I have also removed our dependency on
[pluralize](https://npm.im/pluralize) because we were only loading it to
pluralize three strings: "media type", "operation", and "security type".
Because these can be easily pluralized with a one-liner we don't really
need to import a wholeass library to do this.

[^1]:
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#path-item-object
* **openapi:** tooling upgrades ([#1126](#1126)) ([6678d68](6678d68))

[skip ci]
## 🧰 Changes

The biggest problem I've had since originally building our `openapi
inspect` command has been that the tables between OpenAPI and ReadMe
features aren't of consistent widths. Drives me up a damn wall.

<img width="1309" alt="Screenshot 2024-12-20 at 9 50 05 PM"
src="https://github.com/user-attachments/assets/2cfc1dd6-9bd8-4c1c-bed4-7d627d26e2d0"
/>

So I'm giving a fresh coat of paint to this command that deserves some
love.

* [x] Consistent table widths. <sub>existential grumbling</sub>
* [x] Table headers are now yellow instead of green to reduce the amount
of color thrashing we have going on.
* [x] URLs to OpenAPI spec definitions our own docs are now dimmed
instead of grey.
* [x] Tossed an emoji on the different feature sections. 🌲 for OpenAPI
and 📖 for us.
* [x] Swapped out the ✅ emoji for used features in place of 🟢 and 🔴
circles.
* [x] Usage strings like "2 Media Types", "a total of 9 Operations", or
"a single Security Type" are now lowercased because it looked funky as
hell.
* [x] Bumped OpenAPI spec links to the latest versions for 3.0 and 3.1.

I also made a couple minor readability to how we construct this table
because the code was a bit gnar with some deeply nested `array.push()`
calls.

## 🧬 QA & Testing

This is what it all looks like:

<img width="1426" alt="Screenshot 2024-12-20 at 9 42 57 PM"
src="https://github.com/user-attachments/assets/99028b5d-85a6-423e-a578-b4c095ca0cee"
/>

---------

Co-authored-by: Kanad Gupta <git@kanad.dev>
## 🧰 Changes

Before:

```
Package                                        Current          Wanted   Latest  Location                                             Depended by
@commitlint/cli                                 19.6.0          19.6.1   19.6.1  node_modules/@commitlint/cli                         rdme
@oclif/core                                     4.0.34           4.2.0    4.2.0  node_modules/@oclif/core                             rdme
@oclif/plugin-autocomplete                      3.2.11          3.2.16   3.2.16  node_modules/@oclif/plugin-autocomplete              rdme
@oclif/plugin-help                              6.2.18          6.2.20   6.2.20  node_modules/@oclif/plugin-help                      rdme
@oclif/plugin-not-found                         3.2.29          3.2.33   3.2.33  node_modules/@oclif/plugin-not-found                 rdme
@oclif/plugin-warn-if-update-available          3.1.24          3.1.29   3.1.29  node_modules/@oclif/plugin-warn-if-update-available  rdme
@oclif/test                                      4.1.2           4.1.6    4.1.6  node_modules/@oclif/test                             rdme
@rollup/plugin-commonjs                         28.0.1          28.0.2   28.0.2  node_modules/@rollup/plugin-commonjs                 rdme
@rollup/plugin-node-resolve                     15.3.0          15.3.1   16.0.0  node_modules/@rollup/plugin-node-resolve             rdme
@rollup/plugin-replace                           6.0.1           6.0.2    6.0.2  node_modules/@rollup/plugin-replace                  rdme
chalk                                            5.3.0           5.4.1    5.4.1  node_modules/chalk                                   rdme
debug                                            4.3.7           4.4.0    4.4.0  node_modules/debug                                   rdme
eslint                                          8.57.1          8.57.1   9.17.0  node_modules/eslint                                  rdme
ignore                                           6.0.2           6.0.2    7.0.0  node_modules/ignore                                  rdme
knip                                            5.39.0          5.41.1   5.41.1  node_modules/knip                                    rdme
nock                                    14.0.0-beta.18  14.0.0-beta.19   13.5.6  node_modules/nock                                    rdme
oas                                             25.0.4          25.2.1   25.2.1  node_modules/oas                                     rdme
oas-normalize                                   11.1.4          11.1.4   12.0.0  node_modules/oas-normalize                           rdme
oclif                                           4.16.0         4.17.10  4.17.10  node_modules/oclif                                   rdme
prettier                                         3.4.1           3.4.2    3.4.2  node_modules/prettier                                rdme
rollup                                          4.28.0          4.30.0   4.30.0  node_modules/rollup                                  rdme
table                                            6.8.2           6.9.0    6.9.0  node_modules/table                                   rdme
type-fest                                       4.29.1          4.31.0   4.31.0  node_modules/type-fest                               rdme
undici                                          5.28.4          5.28.4    7.2.0  node_modules/undici                                  rdme
```

After:

```
Package               Current          Wanted  Latest  Location                    Depended by
eslint                 8.57.1          8.57.1  9.17.0  node_modules/eslint         rdme
nock           14.0.0-beta.19  14.0.0-beta.19  13.5.6  node_modules/nock           rdme
oas                    25.0.4          25.2.1  25.2.1  node_modules/oas            rdme
oas-normalize          11.1.4          11.1.4  12.0.0  node_modules/oas-normalize  rdme
undici                 5.28.4          5.28.4   7.2.0  node_modules/undici         rdme
```

`oas` and `oas-normalize` are being bumped in
#1126

---------

Co-authored-by: Jon Ursenbach <jon@ursenba.ch>
* **openapi:** a fresh coat of paint on `openapi inspect` ([#1127](#1127)) ([ff8c304](ff8c304))

[skip ci]
Bumps [@oclif/core](https://github.com/oclif/core) from 4.2.0 to 4.2.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/oclif/core/releases"><code>@​oclif/core</code>'s
releases</a>.</em></p>
<blockquote>
<h2>4.2.1</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump ansis from 3.4.0 to 3.5.2 (<a
href="https://redirect.github.com/oclif/core/issues/1282">#1282</a>) (<a
href="https://github.com/oclif/core/commit/bc1580b432d80b084cb7698c83341826de79a63d">bc1580b</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/oclif/core/blob/main/CHANGELOG.md"><code>@​oclif/core</code>'s
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/oclif/core/compare/4.2.0...4.2.1">4.2.1</a>
(2025-01-06)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump ansis from 3.4.0 to 3.5.2 (<a
href="https://redirect.github.com/oclif/core/issues/1282">#1282</a>) (<a
href="https://github.com/oclif/core/commit/bc1580b432d80b084cb7698c83341826de79a63d">bc1580b</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/oclif/core/commit/272b8d09516e86f816f83bdce19b4e30b30b7edb"><code>272b8d0</code></a>
chore(release): 4.2.1 [skip ci]</li>
<li><a
href="https://github.com/oclif/core/commit/bc1580b432d80b084cb7698c83341826de79a63d"><code>bc1580b</code></a>
fix(deps): bump ansis from 3.4.0 to 3.5.2 (<a
href="https://redirect.github.com/oclif/core/issues/1282">#1282</a>)</li>
<li><a
href="https://github.com/oclif/core/commit/625e72a552cc9e4b55084daee647b17402925958"><code>625e72a</code></a>
chore(dev-deps): bump <code>@​oclif/plugin-plugins</code> from 5.4.19 to
5.4.24 (<a
href="https://redirect.github.com/oclif/core/issues/1286">#1286</a>)</li>
<li><a
href="https://github.com/oclif/core/commit/e4a014e598624174df277ecbe1deccc622b5996a"><code>e4a014e</code></a>
chore(dev-deps): bump <code>@​oclif/plugin-help</code> from 6.2.19 to
6.2.20 (<a
href="https://redirect.github.com/oclif/core/issues/1283">#1283</a>)</li>
<li><a
href="https://github.com/oclif/core/commit/82b0ba206a380f4ce37d6bf864df73bbd1f4d891"><code>82b0ba2</code></a>
chore(dev-deps): bump commitlint from 19.6.0 to 19.6.1 (<a
href="https://redirect.github.com/oclif/core/issues/1278">#1278</a>)</li>
<li><a
href="https://github.com/oclif/core/commit/bcd0a38a8b71ee460646d65cbb422d5fd904a4c0"><code>bcd0a38</code></a>
Merge pull request <a
href="https://redirect.github.com/oclif/core/issues/1285">#1285</a> from
oclif/dependabot-npm_and_yarn-lint-staged-15.3.0</li>
<li><a
href="https://github.com/oclif/core/commit/b15fe1ef3074f18098d274ed21ff9e24efae563e"><code>b15fe1e</code></a>
chore(dev-deps): bump lint-staged from 15.2.11 to 15.3.0</li>
<li><a
href="https://github.com/oclif/core/commit/365fb6bd46ec75c4886b87d1f7576a667778add2"><code>365fb6b</code></a>
Merge pull request <a
href="https://redirect.github.com/oclif/core/issues/1279">#1279</a> from
oclif/dependabot-npm_and_yarn-oclif-test-4.1.4</li>
<li><a
href="https://github.com/oclif/core/commit/3476b936de178c1d5110f7d51bc4f54bf17796f1"><code>3476b93</code></a>
chore(dev-deps): bump <code>@​oclif/test</code> from 4.1.3 to 4.1.4</li>
<li>See full diff in <a
href="https://github.com/oclif/core/compare/4.2.0...4.2.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@oclif/core&package-manager=npm_and_yarn&previous-version=4.2.0&new-version=4.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@kanadgupta kanadgupta changed the base branch from next to v9 January 6, 2025 20:57
kanadgupta and others added 7 commits January 6, 2025 15:00
when reviewing #1126, i noticed a
few small bugs in our `prepareOas` helper function. this PR makes a few
typesafety improvements so we shouldn't run into this issue again(?)

~~one outstanding question that i'd like to figure out prior to merge,
see #1142 (**edit**: going to
continue bundling and handle this issue in a follow-up PR)

do tests + types pass?
* **openapi:** type fixes in `prepareOas` ([#1141](#1141)) ([fc55d28](fc55d28))

[skip ci]
@kanadgupta kanadgupta added bug Something isn't working enhancement New feature or request dependencies Pull requests that update a dependency file command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands labels Jan 6, 2025
@kanadgupta kanadgupta requested a review from erunion January 6, 2025 21:27
@kanadgupta kanadgupta marked this pull request as ready for review January 6, 2025 21:27
CONTRIBUTING.md Show resolved Hide resolved
@kanadgupta kanadgupta merged commit 14828db into v9 Jan 6, 2025
12 checks passed
@kanadgupta kanadgupta deleted the kanad-2025-01-06/v9-backport branch January 6, 2025 22:10
kanadgupta pushed a commit that referenced this pull request Jan 6, 2025
# [9.1.0](v9.0.5...v9.1.0) (2025-01-06)

### Features

* **v9:** backport openapi tooling etc. from v10 ([#1145](#1145)) ([14828db](14828db))

[skip ci]
@kanadgupta
Copy link
Member Author

🎉 This PR is included in version 9.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

kanadgupta added a commit that referenced this pull request Jan 6, 2025
## 🧰 Changes

takes the following changes from `v9` and reapplies them into `next` so
the branches are in sync:

- [x] #1145
- [x]
1cb1c4d
- [x]
44779e2

very curious if there's a better way to do this lol

## 🧬 QA & Testing

do tests pass?

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Jon Ursenbach <jon@ursenba.ch>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
kanadgupta pushed a commit that referenced this pull request Jan 6, 2025
# [10.1.0-next.4](v10.1.0-next.3...v10.1.0-next.4) (2025-01-06)

### Features

* **v9:** backport openapi tooling etc. from v10 ([#1145](#1145)) ([14828db](14828db))

[skip ci]
@kanadgupta
Copy link
Member Author

🎉 This PR is included in version 10.1.0-next.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

kanadgupta pushed a commit that referenced this pull request Jan 14, 2025
# [10.1.0](v10.0.0...v10.1.0) (2025-01-14)

### Bug Fixes

* **openapi:** type fixes in `prepareOas` ([#1141](#1141)) ([fc55d28](fc55d28))

### Features

* **openapi:** a fresh coat of paint on `openapi inspect` ([#1127](#1127)) ([ff8c304](ff8c304))
* **openapi:** tooling upgrades ([#1126](#1126)) ([6678d68](6678d68))
* **v9:** backport openapi tooling etc. from v10 ([#1145](#1145)) ([14828db](14828db))

[skip ci]
@kanadgupta
Copy link
Member Author

🎉 This PR is included in version 10.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands dependencies Pull requests that update a dependency file enhancement New feature or request released on @next released on @v9 released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants