Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

fix: issues preventing people from upgrading off our legacy explorer #602

Merged
merged 9 commits into from
Apr 15, 2020

Conversation

erunion
Copy link
Member

@erunion erunion commented Apr 14, 2020

🧰 What's being changed?

This resolves a handful of issues that are preventing people from upgrading off our legacy API Explorer:

  • If we have a language that's technically unsupported by our code snippet generator (like JSON or HTTP), still make an attempt to capitalize the languages name by running it through our common @readme/syntax-highlighter/uppercase method. Without this, there might be a case where a language like JSON ends up in the Explorer's code tab (by way of the manual API editor example) as "json".
  • Stop nesting JSON response examples in a double <div className="example example_json">.
  • If a legacy response hasn't been fully configured yet, it will have a status code of "" so we should ignore it so as to not render an empty tab in the ResponseExample component.
  • If a requestBody had a title or description, we'd retain that text and show some orphan content. (see fix: bug where requestBody title and descriptions would come through oas#160)
  • If there was an OAS that was synced into our system that didn't have a servers object (something that could have been possible before we tightened down our OAS validation), we should still try to render the PathUrl for that as @readme/oas-tooling will set the base URL to https://example.com if no server base URL is present.

🗳 Checklist

💡 If answering yes to any of the following, include additional info, before/after links, screenshots, etc. where appropriate!

  • 🆕 I'm adding something new!
  • 🐛 I'm fixing a bug!
  • 📸 I've made some changes to the UI!

@erunion erunion added the type:bug Something isn't working label Apr 14, 2020
@erunion erunion marked this pull request as ready for review April 15, 2020 20:54
Copy link
Contributor

@rafegoldberg rafegoldberg left a comment

Choose a reason for hiding this comment

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

Great to see all this clean up. Code looks good by me.

<div className="example example_json">{transformExampleIntoReactJson(example)}</div>
transformExampleIntoReactJson(example)
Copy link
Contributor

Choose a reason for hiding this comment

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

👏

packages/api-explorer/src/lib/upgrade-legacy-responses.js Outdated Show resolved Hide resolved
Co-Authored-By: Rafe Goldberg <rafegoldberg@gmail.com>
@erunion erunion merged commit 4385347 into master Apr 15, 2020
@erunion erunion deleted the fix/legacy-upgrade-issues branch April 15, 2020 22:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants