Skip to content

Commit

Permalink
Merge pull request #245 from lukashornych/244-values-of-some-associat…
Browse files Browse the repository at this point in the history
…ed-data-are-not-displayed-in-entity-grid

fix(entity-viewer): property keys cases inconsistency leading to missing values in grid. Refs #244
  • Loading branch information
lukashornych authored Nov 29, 2024
2 parents 55201cb + bcdaa17 commit cf9fd74
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
10 changes: 5 additions & 5 deletions src/modules/entity-viewer/viewer/service/EntityViewerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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}`,
Expand Down
17 changes: 4 additions & 13 deletions src/modules/entity-viewer/viewer/service/EvitaQLQueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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}'.`)
}
Expand Down Expand Up @@ -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}'.`)
}
Expand Down Expand Up @@ -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}'.`)
}
Expand All @@ -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}'.`)
}
Expand Down
16 changes: 4 additions & 12 deletions src/modules/entity-viewer/viewer/service/GraphQLQueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}'.`)
}
Expand Down Expand Up @@ -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}'.`)
}
Expand Down Expand Up @@ -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}'.`)
}
Expand All @@ -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}'.`)
}
Expand Down

0 comments on commit cf9fd74

Please sign in to comment.