* feat(ux): enhance media-type switching experience in RequestBodyEditor
1. When canceling the try-out mode the request body will be reset to its initial state.
2. When the user switches the media-type in the try-out mode, the experience is as follows:
- If the user did edit the request body the body wont be touched and only media type is updated. This is to ensure that user content is NEVER accidentally overwritten with a default value.
- If the user did not edit the request body it is safe to be replaced by the default value of the target media-type.
Multiple example needed some care in order to allow the retain example value to function properly
* fix(test): workaround cypress issue that can't be reproduced manually
* test: added new feature to ensure enhanced user editing flow
Signed-off-by: mathis-m <mathis.michel@outlook.de>
* patch(#5672): code highlight styles are now only applied to pre blocks that have the class pre.microlight
* fixed pre style appied to .request-url
* fixed response-headers and request-duration pre blocks
* made pre.microlight class as per review
* added microlight class to appropriate pre and added tests
* add opt-in Prettier config
* remove legacy `examples` implementation
* create ExamplesSelect
* support `Response.examples` in OpenAPI 3
* create response controls group
* prettier reformat
* prepare to break up Parameters
* reunify Parameters and OAS3 Parameters
* Parameter Examples
* Example component
* handle parameter value stringification correctly
* FOR REVIEW: add prop for controlling Select
* use regular header for param examples in Try-It-Out
* manage active examples member via Redux
* Request Body Try-It-Out examples
* remove special Response description styling
* omit Example value display in Try-It-Out
* support disabled text inputs in JsonSchemaForm
* Example.omitValue => Example.showValue
* ExamplesSelectValueRetainer
* styling for disabled inputs
* remove console.log
* support "Modified Values" in ExamplesSelect
* remove Examples component
(wasn't used anywhere)
* use ParameterRow.getParamKey for active examples member keying
* split-rendering of examples in ParameterRow
* send disabled prop to JsonSchemaForm
* use content type to key request body active examples members
* remove debugger
* rewire RequestBodyEditor to be a controlled component
REVIEW: does this have perf implications?
* trigger synthetic onSelect events in ExamplesSelect
* prettier updates
* remove outdated Examples usage in RequestBody
* don't handle examples changes in ESVR
* make RequestBodyEditor semi-controlled
* don't default to an empty Map for request bodies
* add namespaceKey to ESVR for state mgmt
* don't key RequestBody activeExampleKeys on media type
* tweak ESVR isModifiedValueSelected calculation
* add trace class to ExamplesSelect
* remove usage of ESVR.currentNamespace
* reset to first example if currentExampleKey is invalid
* add default values to RequestBody rendering
* stringify things in ESVR
* avoid null select value (silences React warning)
* detect user inputs that match any examples member's value
* add trace class for json-schema-array
* shallowly convert namespace state, to preserve Immutable stucts in state
* stringify RBE values; don't trim JSON in editor
* match user input to an example when non-primitives are expressed in state as strings
* update Cypress
* don't apply sample values in JsonSchema_Object
* support disabling all JsonSchemaForm subcomponents
* Core tests
* style changes to accomodate Examples
* fix version-checking error in Response
* disable SCU for Responses
* don't stringify Select values
* ModelExample: default to Model tab if no example is available; provide a default no example message
* don't trim JSON ParamBody inputs
* read directly from 2.0 Response.schema instead of inferring a value
* show current Example information in RequestBody
* show label for Examples dropdown by default
* rework Response content ordering
* style disabled textareas like other read-only blocks
* meta: fix sourcemaps
* refactor ESVR setNameForNamespace
* protect second half of ternary expession
* cypress: `select.examples-select` => `.examples-select > select`
* clarify ModelExample.componentWillReceiveProps
* add gates/defaults to prevent issues in very bare-boned documents
* fix test block organization problem
* simplify RequestBodyEditor interface
* linter fixes
* prettier updates
* use plugin system for new components
* move ME Cypress helpers to other file
* create VersionPragmaFilter component
* use VersionPragmaFilter in BaseLayout
* tighten version idenitifier constraints
* handle case where user specifies a valid `swagger` and `openapi` field
* add traceable class names for each message
* add tests
* linter fixes!
* UNRELATED CHANGE: remove travis short-circuit
* add bypass switch to VersionPragmaFilter
* default to empty `ImmutableMap` when grabbing op metadata
* pass `errors` into JsonSchema components
* Account for Immutable data structure in JavaScriptonSchema...
...and create empty Lists instead of Maps by default.
* Pass ImmutableList through to JsonSchema child components
* Add lazy resolving spec state extensions
* TEMPORARY: disable conventional resolved spec
* WIP
* Use resolveSubtree in Operation display
* Freebie: short-circuit Markdown component if it is given plaintext
* NEW DEFAULT BEHAVIOR: `defaultModelsExpandDepth: 1` does not expand individual models
* Render faked Model expander to trigger resolution
* Baseline support for Editor lifecycles
* Display operation summaries before the operation is resolved
* Test migrations
* WIP
* Swagger2 TIO Body params
* a bit of cleanup
* Debounce string param inputs
* Reach into unresolved operation for deprecated flag, if available
* Fire subtree request outside of render
* Remove debugging flags
* Fix logical errors in spec statePlugins
* TODOs become TODONEs!
* Migrate deeplinking feature to non-resolved spec action
* ESLint fixes
* Reduce action dispatch volume; run resolver on next tick
* Batch resolver requests; use batch progressive results in later iterations
* Add loading states to Model and Operation views
* Preserve object order; remove dupl. import; add warning for action
* LINTER!
* Use require to load SVG
Works around Webpack weirdness
When using `swagger-ui` for consumption by JavaScript web projects
that include module bundlers, instead of `swagger-ui-dist`
there is no `box-sizing: border-box` on `.wrapper`
and it's width overflows because of additional `padding: 0 20px`
Contains a breaking internal API change to `errActions.newThrownErr`, which will require a MINOR version bump. Swagger-Editor does not depend on the old usage style.