Replies: 1 comment
-
Swagger-UI provides a Plugin API to do such things. You could add the OAS format property to the parameter schema where you want a multiline element. Just like: type: string
format: multiline Then you can define a react component with the key import React from "react";
const JsonSchema_string_multiline = (props) => {
const multilineValue = props.value || ""
let errors = props.errors
errors = errors.toJS ? errors.toJS() : []
return (
<input
className={errors.length ? "invalid" : ""}
type="textarea"
title={errors.length ? errors : ""}
onChange={e => props.onChange(e.target.value, props.keyName)}
disabled={props.disabled}
value={multilineValue} >
)
} Now you can define your plugin: const MultilinePlugin = {
components: {
JsonSchema_string_multiline: JsonSchema_string_multiline,
}
}; Now you need to edit the index.html where swagger is intantiated, to include your custom plugin: const ui = SwaggerUIBundle({
url: "https://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
MultilinePlugin // insert here
],
layout: "StandaloneLayout"
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there no option to easily change a textbox input control to a text area?
There are times where my param input values are longer than the viewable textbox area. I would like to be able to view that in a word-wrapped text area.
Beta Was this translation helpful? Give feedback.
All reactions