Skip to content

Commit

Permalink
fix(oas31): avoid capitalizing first character of components.schemas (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored May 24, 2023
1 parent 1931b45 commit 4ad45f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/core/plugins/json-schema-2020-12/fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
6 changes: 1 addition & 5 deletions src/core/plugins/oas31/components/models/models.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const Models = ({
layoutActions,
getComponent,
getConfigs,
fn,
}) => {
const schemas = specSelectors.selectSchemas()
const hasSchemas = Object.keys(schemas).length > 0
Expand Down Expand Up @@ -92,7 +91,7 @@ const Models = ({
key={schemaName}
ref={handleJSONSchema202012Ref(schemaName)}
schema={schema}
name={fn.upperFirst(schemaName)}
name={schemaName}
onExpand={handleJSONSchema202012Expand(schemaName)}
/>
))}
Expand All @@ -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

0 comments on commit 4ad45f8

Please sign in to comment.