Commit Graph

45 Commits

Author SHA1 Message Date
Shelby Sanders
6a4e52aadb feat: support for showExtensions on Response objects (#6535) 2020-10-21 18:49:39 -07:00
Mahtis Michel
87ab4e9ac9 fix: response examples should respect media-type (#6456)
* response sample generation should take content type into consideration for stringify
2020-10-16 13:52:21 -07:00
Adrien Becchis
b5e8081115 fix(syntax-highlighter): configuration for Examples (#6455)
* Complement #5259, getConfigs was not correctly forwarded to Examples. As a result, syntax highlight could not be disabled be disabled or configured in that elements
2020-10-02 14:44:46 -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
blacktemplar
f8dd4e68ec feat(model view): hide applicable readOnly and writeOnly properties (#5832) 2020-06-15 13:47:26 -07:00
Vladimir Gorej
a616cb471d fix(Markdown): render markdown in more secure way
This commit changes markdown sanitization behaviour in following way:

class, style and data-* attributes are removed by default. These attributes
open possible vulnerability vectors to attackers.

The original behavior of sanitizer (before this commit) can be enabled by *useUnsafeMarkdown* configuration option.
Use this configuration option with caution and only in cases when you know
what you're doing.
2020-06-11 21:51:15 +02:00
thierrydallacroce
0b3489b52d fix: remove .col class that causes collision with Bootstrap (via #5541)
* improvement: address Bootstrap conflict by removing our .col class (#4574)

* use `.parameters-col_description` selector in Cypress tests
2019-08-20 19:51:45 -07:00
kyle
39f8ceba55 fix: empty ModelExample rendering in a Response w/o content (via #5504)
* add failing test

* use falsy notSetValue for oas3SchemaForContentType
2019-07-29 22:15:19 -05:00
kyle
a9493a27be fix: Swagger 2.0 Response.examples, again (via #5465)
* fix: Swagger 2.0 `Response.examples`

* stringify results
2019-07-13 01:01:57 -05:00
kyle
9749a47853 fix: Swagger 2.0 Response.examples (via #5464) 2019-07-13 00:25:43 -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
478d93ae08 Example (#4730)
* add tests for example feature
* refactor ParameterRow value setter logic
* aside: fix property access in sampleFromSchema
* prioritize media type examples for OAS3 responses
* use `example` in schema level example
* refactor: move stringify to utils
* prioritize media type examples in OAS3 request bodies
* modify nightwatch config
* fix parameter/response regressions
* reorder and broaden default value sources
* update lockfile
2018-07-14 03:09:37 -04:00
Kyle Shockey
9bad35ed85 Refactor specPath to Im data structures to avoid waste renders 2017-12-28 18:04:12 -06:00
kyle
bfb4c7a8d7 Merge branch 'master' into feature/spec-path 2017-12-07 16:49:34 -08:00
daniel-smartbear
00a059b8dd fix response header type not showing, and displaying example below if theres one present 2017-11-30 10:55:17 +00:00
Kyle Shockey
0ef0613020 Remove Response update logic; dispatch changeProducesValue correctly 2017-11-16 22:25:19 -08:00
Josh Ponelat
91d4ab96d7 partial specPath changes 2017-11-03 17:50:46 +02:00
Owen Conti
b15942dfe1 Merge branch 'ft/performance' of github.com:swagger-api/swagger-ui into ft/performance
# Conflicts:
#	src/core/components/responses.jsx
2017-10-22 12:55:51 -06:00
kyle
263f6feb2f Merge branch 'master' into ft/default_model_rendering 2017-09-29 13:29:04 -07:00
Owen Conti
590819ad9b Fixes swagger-editor/#1502.
Change logic for markdown rendering to:

1. Convert source markdown to HTML
2. Sanitize HTML
3. Send sanitized HTML to markdown renderer
2017-09-27 18:05:12 -06:00
Kyle Shockey
69941a6d9a Remove $$ref values from response examples 2017-09-20 17:34:23 -07:00
Owen Conti
f4efae0145 Merge branch 'ft/performance' into ft/3598-responses-shouldComponentUpdate
# Conflicts:
#	src/core/components/operation.jsx
#	src/core/components/operations.jsx
#	src/core/components/response.jsx
#	src/core/components/responses.jsx
2017-09-15 22:30:23 -06:00
Kyle Shockey
277cc81a8c OAS3 Accept header control: State-side 2017-09-12 19:39:52 -07:00
Kyle Shockey
26edaa5f0b OAS3 Accept header control: Component-side 2017-09-12 17:22:51 -07:00
Owen Conti
a47cc284f7 Update response.jsx to use already existing, fromJSOrdered function 2017-09-12 23:06:24 -06:00
Owen Conti
408e038b2d fromJS does not maintain order of object properties. Use a reviver function with fromJS inside the response.jsx component for the passed down schema prop. 2017-09-11 20:28:58 -06:00
Mike Gilbode
d7ae284a0c Add defaultModelRendering parameter. 2017-08-30 23:30:57 -04:00
Owen Conti
cfb4625eb0 Add shouldComponentUpdate to response.jsx and live-response.jsx. Remove isShownKey from shouldComponentUpdate of OperationContainer. Moved response and request out to separate props for operation.jsx. Removed unused request prop from responses.jsx. 2017-08-20 18:50:49 -06:00
Kyle
c5f5eff900 Merge branch 'master' into bug/3447-write-only 2017-08-10 17:16:51 -07:00
Kyle Shockey
9bb0cd7689 Correct funky CSS for links 2017-08-08 19:20:28 -07:00
Kyle Shockey
15b70b6f2d Set writeOnly flags in correct places 2017-08-03 17:42:04 -07:00
Kyle Shockey
5d78454778 Fix Swagger2 Response Example value rendering 2017-07-31 15:29:36 -07:00
Kyle Shockey
b373182afe ESLint fixes 2017-07-28 19:47:46 -07:00
Kyle Shockey
4e80e292b2 Merge branch 'master' into ft/oas3 2017-07-04 23:50:00 -07:00
Kyle Shockey
1e40a20e07 Add switching logic for each Response Code to have its own content types 2017-07-02 23:02:44 -07:00
RVKen
d36f0a6dbd fix eslint issues 2017-06-29 04:37:19 +02:00
Owen Conti
de3046e29d #3256 - Remove unnecessary JSON.stringify call on example values that are already strings 2017-06-25 16:39:54 -06:00
Kyle Shockey
e3ae1eebfe MOAR rendering (improve media type detection; render object model
nullables)
2017-06-16 14:23:09 -07:00
Kyle Shockey
9dc9a857b7 Squash commit: Links reimplementation; OAS interface improvements 2017-06-16 00:29:23 -07:00
Mark H. Wilkinson
7d24a95d78 Indent JSON examples. 2017-06-13 23:07:44 +01:00
Kyle Shockey
23b1a8aabd Finish rewiring Markdown provider 2017-06-01 21:41:28 -07:00
Kyle Shockey
df47e0e956 Disable HTML rendering in React-Markdown 2017-06-01 09:43:13 -07:00
Anna Bodnia
c86199a506 fix #2800 2017-04-04 12:39:26 +03:00
Kyle Shockey
f195d01184 Autofix ESLint problems 2017-03-22 20:40:05 -07:00
Ron
f22a628934 in with the new 2017-03-17 21:17:53 -07:00