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(openapi): a fresh coat of paint on openapi inspect #1127

Merged
merged 6 commits into from
Jan 6, 2025

Conversation

erunion
Copy link
Member

@erunion erunion commented Dec 21, 2024

🧰 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.

Screenshot 2024-12-20 at 9 50 05 PM

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

  • Consistent table widths. existential grumbling
  • Table headers are now yellow instead of green to reduce the amount of color thrashing we have going on.
  • URLs to OpenAPI spec definitions our own docs are now dimmed instead of grey.
  • Tossed an emoji on the different feature sections. 🌲 for OpenAPI and 📖 for us.
  • Swapped out the ✅ emoji for used features in place of 🟢 and 🔴 circles.
  • 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.
  • 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:

Screenshot 2024-12-20 at 9 42 57 PM

@erunion erunion added enhancement New feature or request command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands labels Dec 21, 2024
let msg: string;
msg = `You have a total of ${chalk.bold(info.found)} ${pluralize(info.name.toLowerCase(), info.found)} in your API.`;
if (info.found > 100) {
msg += ` ${chalk.cyanBright('Wow! 🤯')}`;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iffy on the emoji but thought it might be fun for the true Big API sickos if this stood out a bit more. also might bump this 100 operation threshold up to maybe 200 because after this week of debugging failed API uploads 100 operations in a single file seems so small

Screenshot 2024-12-20 at 9 44 03 PM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obsessed with this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ended up bumping this up to 200

report.push(
table(tableData, {
border: tableBorder,
columns: {
0: {
width: 26,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caps the "Feature" table column to a specific width, which because the second "Used" one doesn't have variable content, causes the width of every table to now be identical.

@erunion erunion marked this pull request as ready for review December 21, 2024 06:01
@erunion erunion requested a review from kanadgupta December 21, 2024 06:01
src/commands/openapi/inspect.ts Outdated Show resolved Hide resolved
let msg: string;
msg = `You have a total of ${chalk.bold(info.found)} ${pluralize(info.name.toLowerCase(), info.found)} in your API.`;
if (info.found > 100) {
msg += ` ${chalk.cyanBright('Wow! 🤯')}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obsessed with this

Base automatically changed from feat/openapi-tooling-upgrades to next January 6, 2025 18:39
@erunion erunion merged commit ff8c304 into next Jan 6, 2025
8 checks passed
@erunion erunion deleted the feat/inspect-coat-of-paint branch January 6, 2025 18:47
kanadgupta pushed a commit that referenced this pull request Jan 6, 2025
# [10.1.0-next.2](v10.1.0-next.1...v10.1.0-next.2) (2025-01-06)

### Features

* **openapi:** a fresh coat of paint on `openapi inspect` ([#1127](#1127)) ([ff8c304](ff8c304))

[skip ci]
@kanadgupta
Copy link
Member

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

The release is available on:

Your semantic-release bot 📦🚀

kanadgupta added a commit that referenced this pull request Jan 6, 2025
## 🧰 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 <[email protected]>
kanadgupta pushed a commit that referenced this pull request Jan 6, 2025
* **openapi:** a fresh coat of paint on `openapi inspect` ([#1127](#1127)) ([ff8c304](ff8c304))

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

reapplies the following changes from the `next` branch onto the `v9`
branch:

- [x] #1124
- [x] #1125
- [x] #1126
- [x] #1127
- [x] #1143
- [x] #1144
- [x] #1141

## 🧬 QA & Testing

do tests pass?

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Jon Ursenbach <[email protected]>
Co-authored-by: semantic-release-bot <[email protected]>
Co-authored-by: Jon Ursenbach <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands enhancement New feature or request released on @next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants