🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-json-schema-ui-editor

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-json-schema-ui-editor - npm Package Compare versions

Comparing version

to
0.2.0

README.md

41

dist/index.js

@@ -23,3 +23,14 @@ // src/components/JsonSchemaContext.tsx

const setSchemaProperty = (path, property) => {
setSchema((prev) => _.setWith(_.clone(prev), path, property, _.clone));
setSchema((prev) => {
const splittedPath = path.split(".");
if (splittedPath[splittedPath.length - 1] === "type" && property === "array") {
return _.setWith(
_.setWith(_.clone(prev), path, property, _.clone),
`${getPropertyPath(splittedPath.slice(0, -1).join("."))}items`,
{ type: "string" },
_.clone
);
}
return _.setWith(_.clone(prev), path, property, _.clone);
});
};

@@ -105,3 +116,3 @@ const removeSchemaProperty = (propertyPath) => {

// src/components/JsonSchemaPropertyRow.tsx
import { useState as useState3 } from "react";
import "react";

@@ -182,3 +193,4 @@ // src/jsonSchemaDescriptor.ts

renderRemovePropertyButton,
renderPropertyName
renderPropertyName,
isArrayItems
}) => {

@@ -189,3 +201,2 @@ const {

} = useJsonSchemaContext();
const [areChildrenCollapsed, setChildrenCollapsed] = useState3(true);
const currentRowState = getPathState(path);

@@ -203,3 +214,6 @@ const currentRowIsObject = currentRowState.type === "object";

onChange: (value) => {
setSchemaProperty(`${getPropertyPath(path)}type`, value);
setSchemaProperty(
`${getPropertyPath(path)}type`,
value
);
},

@@ -213,3 +227,6 @@ value: currentRowState.type,

onChange: (value) => {
setSchemaProperty(`${getPropertyPath(path)}description`, value);
setSchemaProperty(
`${getPropertyPath(path)}description`,
value
);
},

@@ -232,3 +249,6 @@ value: currentRowState.description,

onChange: (value) => {
setSchemaProperty(`${getPropertyPath(path)}enum`, value);
setSchemaProperty(
`${getPropertyPath(path)}enum`,
value
);
},

@@ -247,3 +267,3 @@ value: currentRowState.enum,

),
path && renderRemovePropertyButton({
path && !isArrayItems && renderRemovePropertyButton({
onClick: () => removeSchemaProperty(path)

@@ -265,3 +285,3 @@ })

/* @__PURE__ */ jsxs3("div", { children: [
currentRowIsObject && areChildrenCollapsed && Object.keys(currentRowState.properties || {}).map((prop) => /* @__PURE__ */ jsx2(
currentRowIsObject && Object.keys(currentRowState.properties || {}).map((prop) => /* @__PURE__ */ jsx2(
JsonSchemaPropertyRow,

@@ -286,3 +306,4 @@ {

path: `${getPropertyPath(path)}items`,
name
name: `${name || ""} items`,
isArrayItems: true
}

@@ -289,0 +310,0 @@ )

{
"name": "react-json-schema-ui-editor",
"version": "0.1.0",
"version": "0.2.0",
"description": "React component to edit json schema in a UI.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet