|
| 1 | +// Copyright 2026 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +using System.Text.Json.Serialization; |
| 16 | + |
| 17 | +namespace Google.Cloud.EntityFrameworkCore.Spanner.IntegrationTests.Model; |
| 18 | + |
| 19 | +/// <summary> |
| 20 | +/// JSON type with property names containing special characters that require bracket notation |
| 21 | +/// in JSON path expressions. This is used to test that VisitJsonScalar correctly handles |
| 22 | +/// property names containing dots, spaces, quotes, and backslashes. |
| 23 | +/// </summary> |
| 24 | +public class JsonPropertiesWithSpecialNames |
| 25 | +{ |
| 26 | + /// <summary> |
| 27 | + /// Property with a dot in the JSON name - requires bracket notation $["property.with.dot"] |
| 28 | + /// </summary> |
| 29 | + [JsonPropertyName("property.with.dot")] |
| 30 | + public string PropertyWithDot { get; set; } |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// Property with a space in the JSON name - requires bracket notation $["property with space"] |
| 34 | + /// </summary> |
| 35 | + [JsonPropertyName("property with space")] |
| 36 | + public string PropertyWithSpace { get; set; } |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Property with a single quote in the JSON name - requires bracket notation and quote escaping $["it's"] |
| 40 | + /// </summary> |
| 41 | + [JsonPropertyName("it's")] |
| 42 | + public string PropertyWithSingleQuote { get; set; } |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// Property with double quotes in the JSON name - requires bracket notation and escaping $["say \"hello\""] |
| 46 | + /// </summary> |
| 47 | + [JsonPropertyName("say \"hello\"")] |
| 48 | + public string PropertyWithDoubleQuote { get; set; } |
| 49 | + |
| 50 | + /// <summary> |
| 51 | + /// Normal property without special characters - uses dot notation $.NormalProperty |
| 52 | + /// </summary> |
| 53 | + public string NormalProperty { get; set; } |
| 54 | +} |
0 commit comments