diff --git a/src/core/plugins/json-schema-2020-12/fn.js b/src/core/plugins/json-schema-2020-12/fn.js index 2f77bacf..9e7b16e1 100644 --- a/src/core/plugins/json-schema-2020-12/fn.js +++ b/src/core/plugins/json-schema-2020-12/fn.js @@ -11,8 +11,10 @@ export const upperFirst = (value) => { } export const getTitle = (schema) => { - if (schema?.title) return upperFirst(schema.title) - if (schema?.$anchor) return upperFirst(schema.$anchor) + const fn = useFn() + + if (schema?.title) return fn.upperFirst(schema.title) + if (schema?.$anchor) return fn.upperFirst(schema.$anchor) if (schema?.$id) return schema.$id return "" diff --git a/src/core/plugins/oas31/components/models/models.jsx b/src/core/plugins/oas31/components/models/models.jsx index d3017f1d..5ea7c2c9 100644 --- a/src/core/plugins/oas31/components/models/models.jsx +++ b/src/core/plugins/oas31/components/models/models.jsx @@ -12,7 +12,6 @@ const Models = ({ layoutActions, getComponent, getConfigs, - fn, }) => { const schemas = specSelectors.selectSchemas() const hasSchemas = Object.keys(schemas).length > 0 @@ -92,7 +91,7 @@ const Models = ({ key={schemaName} ref={handleJSONSchema202012Ref(schemaName)} schema={schema} - name={fn.upperFirst(schemaName)} + name={schemaName} onExpand={handleJSONSchema202012Expand(schemaName)} /> ))} @@ -118,9 +117,6 @@ Models.propTypes = { show: PropTypes.func.isRequired, readyToScroll: PropTypes.func.isRequired, }).isRequired, - fn: PropTypes.shape({ - upperFirst: PropTypes.func.isRequired, - }).isRequired, } export default Models