fix(oas31): avoid capitalizing first character of components.schemas (#8710)

Refs #8611
This commit is contained in:
Vladimír Gorej
2023-05-24 15:43:08 +02:00
committed by GitHub
parent 1931b45eb0
commit 4ad45f855d
2 changed files with 5 additions and 7 deletions

View File

@@ -11,8 +11,10 @@ export const upperFirst = (value) => {
} }
export const getTitle = (schema) => { export const getTitle = (schema) => {
if (schema?.title) return upperFirst(schema.title) const fn = useFn()
if (schema?.$anchor) return upperFirst(schema.$anchor)
if (schema?.title) return fn.upperFirst(schema.title)
if (schema?.$anchor) return fn.upperFirst(schema.$anchor)
if (schema?.$id) return schema.$id if (schema?.$id) return schema.$id
return "" return ""

View File

@@ -12,7 +12,6 @@ const Models = ({
layoutActions, layoutActions,
getComponent, getComponent,
getConfigs, getConfigs,
fn,
}) => { }) => {
const schemas = specSelectors.selectSchemas() const schemas = specSelectors.selectSchemas()
const hasSchemas = Object.keys(schemas).length > 0 const hasSchemas = Object.keys(schemas).length > 0
@@ -92,7 +91,7 @@ const Models = ({
key={schemaName} key={schemaName}
ref={handleJSONSchema202012Ref(schemaName)} ref={handleJSONSchema202012Ref(schemaName)}
schema={schema} schema={schema}
name={fn.upperFirst(schemaName)} name={schemaName}
onExpand={handleJSONSchema202012Expand(schemaName)} onExpand={handleJSONSchema202012Expand(schemaName)}
/> />
))} ))}
@@ -118,9 +117,6 @@ Models.propTypes = {
show: PropTypes.func.isRequired, show: PropTypes.func.isRequired,
readyToScroll: PropTypes.func.isRequired, readyToScroll: PropTypes.func.isRequired,
}).isRequired, }).isRequired,
fn: PropTypes.shape({
upperFirst: PropTypes.func.isRequired,
}).isRequired,
} }
export default Models export default Models