Commit Graph

72 Commits

Author SHA1 Message Date
Mahtis Michel
072362244a fix(ui): prevent example select from overflowing (#7060) 2021-03-10 14:07:32 -08:00
Mahtis Michel
e877580d54 feat(ux): enhance media-type switching experience in RequestBodyEditor (#6837)
* 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>
2021-01-25 11:16:07 -08:00
Mahtis Michel
7087210adb fix(style): code should should wrap line (#6831)
* fix(style): code should should wrap line

this time in correct place

* revert(#6764): reverted wrongly placed css
2021-01-14 10:11:03 -08:00
Mahtis Michel
85a3ec983e fix(style): response data flows off the screen (#6764) 2021-01-04 10:44:48 -08:00
David Goss
cfede146ff fix(style): make paths try to stay on single line in opblock (#6243) 2020-07-29 13:30:20 -07:00
Tim Lai
a73783b73d feat: syntax highlighting of code section (#6236)
Co-authored-by: AdrieanKhisbe <adriean.khisbe@live.fr>
2020-07-17 15:29:15 -07:00
tomdegoede
fc3ed30f3d improvement: Move inline styles to SCSS instead (#5578)
* fix: convert propStyle to propClass
2020-06-10 16:39:48 -07:00
Jamie Peabody
e8266a3c6d fix: code highlight styles are now only applied pre.microlight (#5673)
* 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
2019-11-03 20:46:38 -05:00
kyle
23d7260f92 feat: Multiple Examples for OpenAPI 3 Parameters, Request Bodies, and Responses (via #5427)
* 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
2019-06-29 19:52:51 +01:00
kyle
291e2c7251 improvement: operation path + summary overflow styling (via #5184)
* improvement: operation path + summary overflow styling

* inject zero-width spaces for better path breaking

* migrate 4867 regression test to tolerate new ZWSPs

* rm `dev-helpers/doc.yaml`
2019-02-15 20:05:26 -06:00
Sullivan SENECHAL
88e2c9af54 fix: apply css only on first child label and span for section header (via #4970) 2018-11-24 00:16:49 +01:00
Jennifer Kaplan
aec4e378ce housekeeping: remove Topbar CWM & unneeded empty lines (via #5018)
* removed componentWillMount and removed unneeded empty lines

* saved file again
2018-11-12 14:28:28 +01:00
kyle
c5c4e08368 improve: nest Servers within Schemes container (via #4911)
* improve: nest Servers within Schemes container

* linter fixes
2018-09-28 20:33:06 -05:00
Andreas Lind
f1224e5196 fix: remove remaining reference to Titillium webfont (via #4840)
Follow up to #4598
2018-09-06 14:18:51 -07:00
geraldglynn
cb2fc2089c improvement: move operation JumpToPath (via #4760) 2018-08-08 14:10:48 -07:00
Yuanhai He
8cde08bd83 improvement: allow viewing model when Try-It-Out is enabled (via #4723) 2018-07-26 17:47:41 -07:00
kyle
a03c12786a feat(rendering): gate rendering based on valid version identifiers (#4614)
* 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
2018-06-01 16:04:27 -07:00
kyle
9a121ea445 fix: attempt to display Blob response bodies as text (#4437)
* fix: attempt to display Blob response bodies as text

... if nothing else works.

* correctly pass `prevProps.content` to updateParsedContent

* remove debugger statement

* caniuse `Blob` && `FileReader`? yes.

Blob: https://caniuse.com/#search=Blob
FileReader: https://caniuse.com/#search=filereader
2018-04-13 16:16:54 -07:00
Giancarlo Klemm Camilo
2795518340 enhance: scrollable + downloadable HighlightCode (#4397)
* Auto hidding content that is longer than 600 characters long.

* Added basic downloading

Slightly broken

* Better downloading

now downloads file on button click

* Fix the angry linter

* Fix dist

* Removed collapsing, added scrolling.

* Code clean up.

* CSS fix.

* prevent HighlightCode from scrolling entire document

* center "Download" text in button

* `this.downloadJSON` -> `this.downloadText`

we're always saving as `.txt`, so JSON is a misnomer

* hide Download button behind option `downloadable` prop

* `file-saver` -> `js-file-download`
2018-04-12 18:18:49 -07:00
kyle
ba1603a7e2 improve: lazy resolver (#4253)
* 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
2018-02-23 22:25:28 -08:00
Andrew Luca
e531c40356 fix(styles): stop wrapper from overflowing on smaller devices (#4121)
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`
2018-01-19 13:54:01 -06:00
Juan J. Jimenez-Anca
bd41b736a8 feat: display last error when definition/config load fails
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.
2018-01-05 21:45:21 -06:00
Kyle Shockey
00f4fb3326 Add margin to loading container 2017-12-12 13:25:36 -08:00
Kyle Shockey
0864ca849f Use throbber in Standalone layout; center loading messages and content 2017-12-12 13:07:18 -08:00
Kyle Shockey
ef3ccd7a23 Move server styles into its own scss file; add a little polish 2017-11-30 17:06:17 -08:00
Kyle Shockey
0997c5e5d4 Remove hardwired "Server" header, make global one prettier 2017-11-30 14:34:01 -08:00
Kyle Shockey
e5b2193708 Fix Callback Response markdown styling 2017-11-17 22:59:20 -08:00
Hugo Ferrando Seage
3139f3a9d7 Change color of <th>'s border-bottom elements in markdown content 2017-11-14 17:36:06 +01:00
Owen Conti
4b6a89dd53 Fixes #3897 - Change color of <th> elements in markdown content. 2017-11-13 17:29:05 -07:00
Stuart Nichols
1a02364c2f Replace color values with variables for easier theming
Replaced all color values with variables in scss files and
added associated variables to _variables.scss file
2017-11-02 11:50:33 +00:00
Ron
d953b7790d Merge branch 'master' into master 2017-10-20 16:54:03 -07:00
Owen Conti
95002ba6e5 Fixes #3783
Remove extra styles for .renderedMarkdown content.
2017-10-19 14:44:17 -06:00
Race, Dale
499d61161a Decrease summary-path font size on mobile 2017-10-11 09:12:17 -05:00
Owen Conti
2cd4989c05 Fixes #3646
Fix CSS selector for markdown content inside response component.
2017-10-10 15:54:22 -06:00
Joshua Whatley
6488cbb649 Merge branch 'master' into bug/3474 2017-09-18 11:27:10 -07:00
Joshua Whatley
82b9341a06 Changing word-break to follow standard
Changed "break-word" to "break-all" as this is standard across all
browsers and results with consistent behavior.
2017-09-13 21:23:49 -07:00
Kyle Shockey
26edaa5f0b OAS3 Accept header control: Component-side 2017-09-12 17:22:51 -07:00
Joshua Whatley
63ee0a874c break path if it would otherwise overflow 2017-09-08 16:53:43 -07:00
Kyle Shockey
7a2c7d2cdc Squash commit: OAS3 Try-It-Out changes 2017-09-05 13:59:31 -07:00
Surya
f63d2b1ae8 If deeplinking is disabled the anchor tag has no href attribute as a result the mouse pointer is not a pointer as it is no longer a hyperlink, setting the cursor explicitly to pointer. 2017-08-25 23:57:21 +05:30
Kyle Shockey
9bb0cd7689 Correct funky CSS for links 2017-08-08 19:20:28 -07:00
Kyle
b7575ed8a5 Merge branch 'master' into bug/2903-wrong-font-for-error 2017-08-04 16:37:17 -07:00
Owen Conti
d64dfc4252 Fixes #3500 - Fix missing names for primitive models 2017-08-01 20:46:41 -06:00
Kyle Shockey
f7018bc78f Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/oas3 2017-07-28 19:13:24 -07:00
Kyle Shockey
8bbe706918 Disable Try-It-Out button in OAS3
CC: #3436
2017-07-25 21:55:32 -07:00
shockey
4f1772f654 Merge branch 'master' into bug/2903-wrong-font-for-error 2017-07-21 19:19:44 -07:00
Owen Conti
b9bb4c124e Fixes #3434 - Change link style color for .response-col_description__inner links 2017-07-21 18:46:50 -06:00
Owen Conti
54b867a9bc Merge branch 'master' into bug/2903-wrong-font-for-error
# Conflicts:
#	dev-helpers/index.html
2017-07-17 18:51:04 -06:00
Kyle Shockey
7d01a5a8ac Fix external documentation styling 2017-07-14 18:22:01 -07:00
shockey
e77c980ae8 Merge branch 'master' into ft/2884-operation-deep-linking 2017-07-14 15:40:20 -07:00