(
property: SessionEventEnvelopeProperty,
knownTypes: Map<string, string>,
nestedClasses: Map<string, string>,
enumOutput: string[]
)
| 1288 | } |
| 1289 | |
| 1290 | function emitSessionEventEnvelopeProperty( |
| 1291 | property: SessionEventEnvelopeProperty, |
| 1292 | knownTypes: Map<string, string>, |
| 1293 | nestedClasses: Map<string, string>, |
| 1294 | enumOutput: string[] |
| 1295 | ): string[] { |
| 1296 | const csharpName = toCSharpPropertyName(property.name, property.schema); |
| 1297 | const csharpType = resolveSessionPropertyType( |
| 1298 | property.schema, |
| 1299 | "SessionEvent", |
| 1300 | csharpName, |
| 1301 | property.required, |
| 1302 | knownTypes, |
| 1303 | nestedClasses, |
| 1304 | enumOutput |
| 1305 | ); |
| 1306 | const lines: string[] = []; |
| 1307 | |
| 1308 | lines.push(...xmlDocPropertyComment(property.schema.description, property.name, " ")); |
| 1309 | lines.push(...emitDataAnnotations(property.schema, " ", csharpType)); |
| 1310 | if (isSchemaDeprecated(property.schema)) pushObsoleteAttributes(lines, " "); |
| 1311 | if (isSchemaExperimental(property.schema)) pushExperimentalAttribute(lines, " "); |
| 1312 | if (isMillisecondsDurationProperty(property.name, property.schema)) lines.push(` [JsonConverter(typeof(MillisecondsTimeSpanConverter))]`); |
| 1313 | if (!property.required) lines.push(` [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]`); |
| 1314 | const propVisibility = pushCSharpInternalAttribute(lines, property.schema); |
| 1315 | lines.push(` [JsonPropertyName("${property.name}")]`); |
| 1316 | lines.push(` ${propVisibility} ${csharpType} ${csharpName} { get; set; }`, ""); |
| 1317 | |
| 1318 | return lines; |
| 1319 | } |
| 1320 | |
| 1321 | export function generateSessionEventsCode(schema: JSONSchema7): string { |
| 1322 | generatedEnums.clear(); |
no test coverage detected
searching dependent graphs…