fix: generate metadata object and field names in camel case (#2250)

Fixes #2249
This commit is contained in:
Thaïs 2023-10-26 17:27:52 +02:00 committed by GitHub
parent 781a1de8f4
commit b30233d582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 19 deletions

View File

@ -40,7 +40,6 @@
"lodash.camelcase": "^4.3.0", "lodash.camelcase": "^4.3.0",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"lodash.kebabcase": "^4.1.1", "lodash.kebabcase": "^4.1.1",
"lodash.upperfirst": "^4.3.1",
"luxon": "^3.3.0", "luxon": "^3.3.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-data-grid": "7.0.0-beta.13", "react-data-grid": "7.0.0-beta.13",
@ -146,7 +145,6 @@
"@types/lodash.camelcase": "^4.3.7", "@types/lodash.camelcase": "^4.3.7",
"@types/lodash.debounce": "^4.0.7", "@types/lodash.debounce": "^4.0.7",
"@types/lodash.kebabcase": "^4.1.7", "@types/lodash.kebabcase": "^4.1.7",
"@types/lodash.upperfirst": "^4.3.7",
"@types/luxon": "^3.3.0", "@types/luxon": "^3.3.0",
"@types/react-datepicker": "^4.11.2", "@types/react-datepicker": "^4.11.2",
"@types/scroll-into-view": "^1.16.0", "@types/scroll-into-view": "^1.16.0",

View File

@ -1,5 +1,4 @@
import toCamelCase from 'lodash.camelcase'; import toCamelCase from 'lodash.camelcase';
import upperFirst from 'lodash.upperfirst';
import { ObjectFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType'; import { ObjectFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType';
import { Field } from '~/generated-metadata/graphql'; import { Field } from '~/generated-metadata/graphql';
@ -12,6 +11,6 @@ export const formatMetadataFieldInput = (
description: input.description?.trim() ?? null, description: input.description?.trim() ?? null,
icon: input.icon, icon: input.icon,
label: input.label.trim(), label: input.label.trim(),
name: upperFirst(toCamelCase(input.label.trim())), name: toCamelCase(input.label.trim()),
type: input.type, type: input.type,
}); });

View File

@ -1,5 +1,4 @@
import toCamelCase from 'lodash.camelcase'; import toCamelCase from 'lodash.camelcase';
import upperFirst from 'lodash.upperfirst';
import { MetadataObject } from '../types/MetadataObject'; import { MetadataObject } from '../types/MetadataObject';
@ -13,6 +12,6 @@ export const formatMetadataObjectInput = (
icon: input.icon, icon: input.icon,
labelPlural: input.labelPlural.trim(), labelPlural: input.labelPlural.trim(),
labelSingular: input.labelSingular.trim(), labelSingular: input.labelSingular.trim(),
namePlural: upperFirst(toCamelCase(input.labelPlural.trim())), namePlural: toCamelCase(input.labelPlural.trim()),
nameSingular: upperFirst(toCamelCase(input.labelSingular.trim())), nameSingular: toCamelCase(input.labelSingular.trim()),
}); });

View File

@ -5656,13 +5656,6 @@
dependencies: dependencies:
"@types/lodash" "*" "@types/lodash" "*"
"@types/lodash.upperfirst@^4.3.7":
version "4.3.8"
resolved "https://registry.yarnpkg.com/@types/lodash.upperfirst/-/lodash.upperfirst-4.3.8.tgz#b488f406f2325f4271c6904f7f9fb560ad6be813"
integrity sha512-/R/drl34clakjVOVSgUryl7R18RgAuUWYXKuc3S7Aozw2DW+iqE6hvZJugMtdfzML0fGXs+UCDjafCkctlgIug==
dependencies:
"@types/lodash" "*"
"@types/lodash@*", "@types/lodash@^4.14.167": "@types/lodash@*", "@types/lodash@^4.14.167":
version "4.14.197" version "4.14.197"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.197.tgz#e95c5ddcc814ec3e84c891910a01e0c8a378c54b" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.197.tgz#e95c5ddcc814ec3e84c891910a01e0c8a378c54b"
@ -13691,11 +13684,6 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ== integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==
lodash.upperfirst@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"
integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==
lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.7.0, lodash@~4.17.0: lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.7.0, lodash@~4.17.0:
version "4.17.21" version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"