From bcdaa17555e80c5709833bc168fe99411f0d8761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hornych?= Date: Fri, 29 Nov 2024 07:37:03 +0100 Subject: [PATCH] fix(entity-viewer): property keys cases inconsistency leading to missing values in grid. Refs #244 --- .../viewer/service/EntityViewerService.ts | 10 +++++----- .../viewer/service/EvitaQLQueryBuilder.ts | 17 ++++------------- .../viewer/service/GraphQLQueryBuilder.ts | 16 ++++------------ 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/modules/entity-viewer/viewer/service/EntityViewerService.ts b/src/modules/entity-viewer/viewer/service/EntityViewerService.ts index 8bc6d812..a1a7790b 100644 --- a/src/modules/entity-viewer/viewer/service/EntityViewerService.ts +++ b/src/modules/entity-viewer/viewer/service/EntityViewerService.ts @@ -316,7 +316,7 @@ export class EntityViewerService { for (const attributeSchema of entitySchema.attributes.getOrElseGet(() => ImmutableMap()).values()) { descriptors.push(new EntityPropertyDescriptor( EntityPropertyType.Attributes, - EntityPropertyKey.attributes(attributeSchema.nameVariants.getIfSupported()?.get(NamingConvention.CamelCase)!), + EntityPropertyKey.attributes(attributeSchema.name), attributeSchema.name, attributeSchema.name, undefined, @@ -328,7 +328,7 @@ export class EntityViewerService { for (const associatedDataSchema of entitySchema.associatedData.getOrElseGet(() => ImmutableMap()).values()) { descriptors.push(new EntityPropertyDescriptor( EntityPropertyType.AssociatedData, - EntityPropertyKey.associatedData(associatedDataSchema.nameVariants.getIfSupported()?.get(NamingConvention.CamelCase)!), + EntityPropertyKey.associatedData(associatedDataSchema.name), associatedDataSchema.name, associatedDataSchema.name, undefined, @@ -352,7 +352,7 @@ export class EntityViewerService { for (const referenceSchema of entitySchema.references.getOrElseGet(() => ImmutableMap()).values()) { descriptors.push(new EntityPropertyDescriptor( EntityPropertyType.References, - EntityPropertyKey.references(referenceSchema.nameVariants.getIfSupported()?.get(NamingConvention.CamelCase)!), + EntityPropertyKey.references(referenceSchema.name), referenceSchema.name, referenceSchema.name, undefined, @@ -363,8 +363,8 @@ export class EntityViewerService { return new EntityPropertyDescriptor( EntityPropertyType.ReferenceAttributes, EntityPropertyKey.referenceAttributes( - referenceSchema.nameVariants.getIfSupported()?.get(NamingConvention.CamelCase)!, - attributeSchema.nameVariants.getIfSupported()?.get(NamingConvention.CamelCase)! + referenceSchema.name, + attributeSchema.name ), attributeSchema.name, `${referenceSchema.name}: ${attributeSchema.name}`, diff --git a/src/modules/entity-viewer/viewer/service/EvitaQLQueryBuilder.ts b/src/modules/entity-viewer/viewer/service/EvitaQLQueryBuilder.ts index ea54413b..68d840a4 100644 --- a/src/modules/entity-viewer/viewer/service/EvitaQLQueryBuilder.ts +++ b/src/modules/entity-viewer/viewer/service/EvitaQLQueryBuilder.ts @@ -6,7 +6,6 @@ import { EntitySchema } from '@/modules/connection/model/schema/EntitySchema' import { EntityPropertyType } from '@/modules/entity-viewer/viewer/model/EntityPropertyType' import { AttributeSchema } from '@/modules/connection/model/schema/AttributeSchema' import { ConnectionService } from '@/modules/connection/service/ConnectionService' -import { NamingConvention } from '@/modules/connection/model/NamingConvetion' import { UnexpectedError } from '@/modules/base/exception/UnexpectedError' import { AssociatedDataSchema } from '@/modules/connection/model/schema/AssociatedDataSchema' import { ReferenceSchema } from '@/modules/connection/model/schema/ReferenceSchema' @@ -120,9 +119,7 @@ export class EvitaQLQueryBuilder implements QueryBuilder { .map(it => { const attributeSchema: AttributeSchema | undefined = entitySchema.attributes .getIfSupported() - ?.find(attributeSchema => attributeSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === it) + ?.find(attributeSchema => attributeSchema.name === it) if (attributeSchema == undefined) { throw new UnexpectedError(`Could not find attribute '${it}' in '${dataPointer.entityType}' in connection '${dataPointer.connection.name}'.`) } @@ -151,9 +148,7 @@ export class EvitaQLQueryBuilder implements QueryBuilder { .map(it => { const associatedDataSchema: AssociatedDataSchema | undefined = entitySchema.associatedData .getIfSupported() - ?.find(associatedDataSchema => associatedDataSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === it) + ?.find(associatedDataSchema => associatedDataSchema.name === it) if (associatedDataSchema == undefined) { throw new UnexpectedError(`Could not find associated data '${it}' in '${dataPointer.entityType}' in connection '${dataPointer.connection.name}'.`) } @@ -205,9 +200,7 @@ export class EvitaQLQueryBuilder implements QueryBuilder { for (const requiredReference of requiredReferences) { const referenceSchema: ReferenceSchema | undefined = entitySchema.references .getIfSupported() - ?.find(referenceSchema => referenceSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === requiredReference) + ?.find(referenceSchema => referenceSchema.name === requiredReference) if (referenceSchema == undefined) { throw new UnexpectedError(`Could not find reference '${requiredReference}' in '${dataPointer.entityType}' in connection '${dataPointer.connection.name}'.`) } @@ -220,9 +213,7 @@ export class EvitaQLQueryBuilder implements QueryBuilder { .map(referenceAttribute => { const attributeSchema: AttributeSchema | undefined = referenceSchema.attributes .getIfSupported() - ?.find(attributeSchema => attributeSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === referenceAttribute) + ?.find(attributeSchema => attributeSchema.name === referenceAttribute) if (attributeSchema == undefined) { throw new UnexpectedError(`Could not find attribute '${referenceAttribute}' in reference '${requiredReference}' in '${dataPointer.entityType}' in connection '${dataPointer.connection.name}'.`) } diff --git a/src/modules/entity-viewer/viewer/service/GraphQLQueryBuilder.ts b/src/modules/entity-viewer/viewer/service/GraphQLQueryBuilder.ts index 653649e5..84e758db 100644 --- a/src/modules/entity-viewer/viewer/service/GraphQLQueryBuilder.ts +++ b/src/modules/entity-viewer/viewer/service/GraphQLQueryBuilder.ts @@ -148,9 +148,7 @@ export class GraphQLQueryBuilder implements QueryBuilder { .map(it => { const attributeSchema: AttributeSchema | undefined = entitySchema.attributes .getIfSupported() - ?.find(attributeSchema => attributeSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === it) + ?.find(attributeSchema => attributeSchema.name === it) if (attributeSchema == undefined) { throw new UnexpectedError(`Could not find attribute '${it}' in '${dataPointer.entityType}'.`) } @@ -186,9 +184,7 @@ export class GraphQLQueryBuilder implements QueryBuilder { .map(it => { const associatedDataSchema: AssociatedDataSchema | undefined = entitySchema.associatedData .getIfSupported() - ?.find(associatedDataSchema => associatedDataSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === it) + ?.find(associatedDataSchema => associatedDataSchema.name === it) if (associatedDataSchema == undefined) { throw new UnexpectedError(`Could not find associated data '${it}' in '${dataPointer.entityType}'.`) } @@ -253,9 +249,7 @@ export class GraphQLQueryBuilder implements QueryBuilder { for (const requiredReference of requiredReferences) { const referenceSchema: ReferenceSchema | undefined = entitySchema.references .getIfSupported() - ?.find(referenceSchema => referenceSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === requiredReference) + ?.find(referenceSchema => referenceSchema.name === requiredReference) if (referenceSchema == undefined) { throw new UnexpectedError(`Could not find reference '${requiredReference}' in '${dataPointer.entityType}'.`) } @@ -268,9 +262,7 @@ export class GraphQLQueryBuilder implements QueryBuilder { .map(referenceAttribute => { const attributeSchema: AttributeSchema | undefined = referenceSchema.attributes .getIfSupported() - ?.find(attributeSchema => attributeSchema.nameVariants - .getIfSupported() - ?.get(NamingConvention.CamelCase) === referenceAttribute) + ?.find(attributeSchema => attributeSchema.name === referenceAttribute) if (attributeSchema == undefined) { throw new UnexpectedError(`Could not find attribute '${referenceAttribute}' in reference '${requiredReference}' in '${dataPointer.entityType}'.`) }