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

Open
wants to merge 1 commit into
base: feat/openapi-tooling-upgrades
Choose a base branch
from

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

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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant