-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OAS3 binary media type support (#4592)
* fix(validator-badge): resolve definition URLs against browser location * use param as meta parameter if not found * convert request body from Immutable if necessary * show file upload for `format: binary` and `format: base64` jsonschema strings * add `dispatchInitialValue` prop to JsonSchemaForm * add optional subkey parameter to onChange * add binary media type support to request body
- Loading branch information
Showing
8 changed files
with
129 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/core/plugins/oas3/wrap-components/json-schema-string.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from "react" | ||
import { OAS3ComponentWrapFactory } from "../helpers" | ||
|
||
export default OAS3ComponentWrapFactory(({ Ori, ...props }) => { | ||
const { | ||
schema, | ||
getComponent, | ||
errors, | ||
onChange | ||
} = props | ||
|
||
const { type, format } = schema | ||
const Input = getComponent("Input") | ||
|
||
if(type === "string" && (format === "binary" || format === "base64")) { | ||
return <Input type="file" | ||
className={ errors.length ? "invalid" : ""} | ||
title={ errors.length ? errors : ""} | ||
onChange={(e) => { | ||
onChange(e.target.files[0]) | ||
}} | ||
disabled={Ori.isDisabled}/> | ||
} else { | ||
return <Ori {...props} /> | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters