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

Commit

Permalink
feat: request body raw/json mode editor (#1050)
Browse files Browse the repository at this point in the history
* chore(deps): upgrading oas to v6

* chore(deps): upgrading @readme/ui

* chore(deps): upgrading oas to 6.1.0

* refactor: using oas mimetype tooling for contenttype matching

* chore: rebuilding some lock files

* feat: first pass at the json editor

* chore(deps): upgrading @readme/syntax-highlighter

* style(json tab): style the thing

* chore(deps): upgrading @readme/syntax-highlighter

* style(json): try it popover styles

* refactor(json tab): better css var names

* fix(json tab): fix false in classname

* style(json tab): i was 1px off

* fix: removing an unused component import

* chore: removing some debug

* test: fixing broken tests

* test: fixing some react proptype messes to eliminate test warnings

* style: fixing eslint issuese

* refactor: updating some operation schema instances to use operation getters

* fix: catching and tossing promise errors. fixes errors in tests

* chore: removing unnecessary changes i made

* test: adding some unit tests for the Doc component

* fix: reworking the json codeeditor so invalid json can always be reset

* test: more test coverage

* chore(deps): upgrading oas to 6.1.0

* chore: reverting some unnecessary changes

* fix: using the new getOperationId accessor

* fix: using the new getResponseByStatusCode accessor

* fix: typo that was breaking every test

* feat: using a new oas accessor

* test: slightly reducing jest coverage requirements

* fix: rearchitecting how we're storing raw json to fix codeeditor issues

* fix(try it): fix try it button turning red when not invalid, but disabled

* fix(try it): only show popover on hover

* feat: saving two dirty states for each form tab

Co-authored-by: Tony Li <runnabro@users.noreply.github.com>
  • Loading branch information
erunion and runnabro authored Nov 24, 2020
1 parent cf74e31 commit d4c3a83
Show file tree
Hide file tree
Showing 28 changed files with 960 additions and 195 deletions.
14 changes: 13 additions & 1 deletion example/src/Demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Demo extends React.Component {
super(props);
this.state = {
brokenExplorerState: false,
enableJsonEditor: true,
enableTutorials: false,
maskErrorMessages: false,
useNewMarkdownEngine: true,
Expand All @@ -36,6 +37,10 @@ class Demo extends React.Component {
description: null,
stateProp: 'useNewMarkdownEngine',
},
'Enable JSON editor (beta)': {
description: 'Enable our request body JSON editor.',
stateProp: 'enableJsonEditor',
},
'Enable tutorials (beta)': {
description: 'Enable our tutorials beta.',
stateProp: 'enableTutorials',
Expand Down Expand Up @@ -72,7 +77,13 @@ class Demo extends React.Component {

render() {
const { fetchSwagger, status, docs, oas, oasUrl, oauth } = this.props;
const { brokenExplorerState, enableTutorials, maskErrorMessages, useNewMarkdownEngine } = this.state;
const {
brokenExplorerState,
enableJsonEditor,
enableTutorials,
maskErrorMessages,
useNewMarkdownEngine,
} = this.state;

const additionalProps = {
oasFiles: {
Expand Down Expand Up @@ -146,6 +157,7 @@ class Demo extends React.Component {
docs={docs}
// We only really set this to `true` for testing sites for errors using puppeteer
dontLazyLoad={false}
enableRequestBodyJsonEditor={enableJsonEditor}
flags={{ correctnewlines: false }}
glossaryTerms={[{ term: 'apiKey', definition: 'This is a definition' }]}
Logs={Logs}
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
coverageThreshold: {
global: {
branches: 88,
functions: 90,
functions: 88,
lines: 90,
statements: 90,
},
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d4c3a83

Please sign in to comment.