(objectSchema *storepb.ObjectSchema, path *parserbase.PathAST)
| 347 | } |
| 348 | |
| 349 | func getObjectSchemaByPath(objectSchema *storepb.ObjectSchema, path *parserbase.PathAST) (*storepb.ObjectSchema, string) { |
| 350 | outer := objectSchema |
| 351 | outerSemanticType := outer.SemanticType |
| 352 | if outerSemanticType != "" { |
| 353 | return outer, outer.SemanticType |
| 354 | } |
| 355 | for node := path.Root; node != nil; node = node.GetNext() { |
| 356 | identifier := node.GetIdentifier() |
| 357 | switch outer.Type { |
| 358 | case storepb.ObjectSchema_OBJECT: |
| 359 | v := outer.GetStructKind().GetProperties() |
| 360 | if v == nil { |
| 361 | return nil, outerSemanticType |
| 362 | } |
| 363 | inner, ok := v[identifier] |
| 364 | if !ok { |
| 365 | return nil, outerSemanticType |
| 366 | } |
| 367 | outer = inner |
| 368 | outerSemanticType = outer.SemanticType |
| 369 | case storepb.ObjectSchema_ARRAY: |
| 370 | v := outer.GetArrayKind().GetKind() |
| 371 | if v == nil { |
| 372 | return nil, outerSemanticType |
| 373 | } |
| 374 | if v.Type != storepb.ObjectSchema_OBJECT { |
| 375 | return nil, outerSemanticType |
| 376 | } |
| 377 | p := v.GetStructKind().GetProperties() |
| 378 | if p == nil { |
| 379 | return nil, outerSemanticType |
| 380 | } |
| 381 | inner, ok := p[identifier] |
| 382 | if !ok { |
| 383 | return nil, outerSemanticType |
| 384 | } |
| 385 | outer = inner |
| 386 | outerSemanticType = outer.SemanticType |
| 387 | default: |
| 388 | // Other schema types |
| 389 | return nil, outerSemanticType |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | return outer, outerSemanticType |
| 394 | } |
| 395 | |
| 396 | func walkAndMaskJSONRecursive(data any, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker) (any, error) { |
| 397 | if objectSchema == nil { |
no test coverage detected