committed by
Vladimír Gorej
parent
64ee5fa639
commit
7f9ac83f16
@@ -57,6 +57,7 @@ const JSONSchema = ({ schema, name }) => {
|
||||
const KeywordAdditionalProperties = useComponent(
|
||||
"KeywordAdditionalProperties"
|
||||
)
|
||||
const KeywordPropertyNames = useComponent("KeywordPropertyNames")
|
||||
const KeywordType = useComponent("KeywordType")
|
||||
const KeywordFormat = useComponent("KeywordFormat")
|
||||
const KeywordTitle = useComponent("KeywordTitle")
|
||||
@@ -122,6 +123,7 @@ const JSONSchema = ({ schema, name }) => {
|
||||
<KeywordProperties schema={schema} />
|
||||
<KeywordPatternProperties schema={schema} />
|
||||
<KeywordAdditionalProperties schema={schema} />
|
||||
<KeywordPropertyNames schema={schema} />
|
||||
<KeywordAllOf schema={schema} />
|
||||
<KeywordAnyOf schema={schema} />
|
||||
<KeywordOneOf schema={schema} />
|
||||
|
||||
@@ -15,7 +15,7 @@ const AdditionalProperties = ({ schema }) => {
|
||||
const JSONSchema = useComponent("JSONSchema")
|
||||
const name = (
|
||||
<span className="json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary">
|
||||
Additional Properties
|
||||
Additional properties
|
||||
</span>
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import React from "react"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
import { useFn, useComponent } from "../../hooks"
|
||||
|
||||
const PropertyNames = ({ schema }) => {
|
||||
const fn = useFn()
|
||||
|
||||
if (!fn.hasKeyword(schema, "propertyNames")) return null
|
||||
|
||||
const { propertyNames } = schema
|
||||
const JSONSchema = useComponent("JSONSchema")
|
||||
const name = (
|
||||
<span className="json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary">
|
||||
Property names
|
||||
</span>
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="json-schema-2020-12-keyword json-schema-2020-12-keyword--propertyNames">
|
||||
<JSONSchema name={name} schema={propertyNames} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
PropertyNames.propTypes = {
|
||||
schema: schema.isRequired,
|
||||
}
|
||||
|
||||
export default PropertyNames
|
||||
@@ -156,6 +156,7 @@ export const isExpandable = (schema) => {
|
||||
schema?.properties ||
|
||||
schema?.patternProperties ||
|
||||
fn.hasKeyword(schema, "additionalProperties") ||
|
||||
fn.hasKeyword(schema, "propertyNames") ||
|
||||
schema?.description
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import KeywordContains from "./components/keywords/Contains"
|
||||
import KeywordProperties from "./components/keywords/Properties/Properties"
|
||||
import KeywordPatternProperties from "./components/keywords/PatternProperties/PatternProperties"
|
||||
import KeywordAdditionalProperties from "./components/keywords/AdditionalProperties"
|
||||
import KeywordPropertyNames from "./components/keywords/PropertyNames"
|
||||
import KeywordType from "./components/keywords/Type/Type"
|
||||
import KeywordFormat from "./components/keywords/Format/Format"
|
||||
import KeywordTitle from "./components/keywords/Title/Title"
|
||||
@@ -71,6 +72,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
|
||||
KeywordProperties,
|
||||
KeywordPatternProperties,
|
||||
KeywordAdditionalProperties,
|
||||
KeywordPropertyNames,
|
||||
KeywordType,
|
||||
KeywordFormat,
|
||||
KeywordTitle,
|
||||
|
||||
@@ -25,6 +25,7 @@ import KeywordContains from "./components/keywords/Contains"
|
||||
import KeywordProperties from "./components/keywords/Properties/Properties"
|
||||
import KeywordPatternProperties from "./components/keywords/PatternProperties/PatternProperties"
|
||||
import KeywordAdditionalProperties from "./components/keywords/AdditionalProperties"
|
||||
import KeywordPropertyNames from "./components/keywords/PropertyNames"
|
||||
import KeywordType from "./components/keywords/Type/Type"
|
||||
import KeywordFormat from "./components/keywords/Format/Format"
|
||||
import KeywordTitle from "./components/keywords/Title/Title"
|
||||
@@ -61,6 +62,7 @@ const JSONSchema202012Plugin = () => ({
|
||||
JSONSchema202012KeywordProperties: KeywordProperties,
|
||||
JSONSchema202012KeywordPatternProperties: KeywordPatternProperties,
|
||||
JSONSchema202012KeywordAdditionalProperties: KeywordAdditionalProperties,
|
||||
JSONSchema202012KeywordPropertyNames: KeywordPropertyNames,
|
||||
JSONSchema202012KeywordType: KeywordType,
|
||||
JSONSchema202012KeywordFormat: KeywordFormat,
|
||||
JSONSchema202012KeywordTitle: KeywordTitle,
|
||||
|
||||
@@ -40,6 +40,9 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
||||
const KeywordAdditionalProperties = getComponent(
|
||||
"JSONSchema202012KeywordAdditionalProperties"
|
||||
)
|
||||
const KeywordPropertyNames = getComponent(
|
||||
"JSONSchema202012KeywordPropertyNames"
|
||||
)
|
||||
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
||||
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
||||
const KeywordTitle = getComponent("JSONSchema202012KeywordTitle")
|
||||
@@ -81,6 +84,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
||||
KeywordProperties,
|
||||
KeywordPatternProperties,
|
||||
KeywordAdditionalProperties,
|
||||
KeywordPropertyNames,
|
||||
KeywordType,
|
||||
KeywordFormat,
|
||||
KeywordTitle,
|
||||
|
||||
Reference in New Issue
Block a user