Something went wrong. Try again.
.NET ATProtocol Library - Built for Source Gen
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227// <auto-generated />#nullable enable
using System;using System.Collections.Generic;using System.Text.Json;using System.Text.Json.Serialization;
namespace CarpaNet.Models;
/// <summary>/// Represents a Lexicon JSON document./// </summary>public sealed class LexiconDocument{ /// <summary> /// The Lexicon language version (currently always 1). /// </summary> [JsonPropertyName("lexicon")] public int Lexicon { get; set; }
/// <summary> /// The NSID of this Lexicon. /// </summary> [JsonPropertyName("id")] public string Id { get; set; } = string.Empty;
/// <summary> /// Optional description of this Lexicon. /// </summary> [JsonPropertyName("description")] public string? Description { get; set; }
/// <summary> /// The definitions in this Lexicon, keyed by name. /// </summary> [JsonPropertyName("defs")] public Dictionary<string, LexiconDefinition> Defs { get; set; } = new();}
/// <summary>/// Represents a single definition within a Lexicon./// </summary>public sealed class LexiconDefinition{ /// <summary> /// The type of this definition. /// </summary> [JsonPropertyName("type")] public string Type { get; set; } = string.Empty;
/// <summary> /// Optional description. /// </summary> [JsonPropertyName("description")] public string? Description { get; set; }
// Record-specific [JsonPropertyName("key")] public string? Key { get; set; }
[JsonPropertyName("record")] public LexiconDefinition? Record { get; set; }
// Object-specific [JsonPropertyName("properties")] public Dictionary<string, LexiconDefinition>? Properties { get; set; }
/// <summary> /// Raw JSON value for the "required" field. Can be either a string array (object-level) /// or a boolean (property-level, used by some third-party lexicons). /// </summary> [JsonPropertyName("required")] public JsonElement? RequiredRaw { get; set; }
/// <summary> /// Gets the required property names list (from object-level "required": ["field1", "field2"]). /// Returns null if the field is absent or is a boolean. /// </summary> [JsonIgnore] public List<string>? Required { get { if (RequiredRaw == null || RequiredRaw.Value.ValueKind != JsonValueKind.Array) { return null; }
var list = new List<string>(); foreach (var item in RequiredRaw.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.String) { list.Add(item.GetString()!); } }
return list; } }
/// <summary> /// Gets whether this property is individually marked as required via "required": true. /// Used by some third-party lexicons on individual property definitions. /// </summary> [JsonIgnore] public bool IsRequired => RequiredRaw?.ValueKind == JsonValueKind.True;
[JsonPropertyName("nullable")] public List<string>? Nullable { get; set; }
// Array-specific [JsonPropertyName("items")] public LexiconDefinition? Items { get; set; }
[JsonPropertyName("minLength")] public int? MinLength { get; set; }
[JsonPropertyName("maxLength")] public int? MaxLength { get; set; }
// String-specific [JsonPropertyName("format")] public string? Format { get; set; }
[JsonPropertyName("enum")] public List<JsonElement>? Enum { get; set; }
[JsonPropertyName("knownValues")] public List<string>? KnownValues { get; set; }
[JsonPropertyName("default")] public JsonElement? Default { get; set; }
[JsonPropertyName("const")] public JsonElement? Const { get; set; }
[JsonPropertyName("maxGraphemes")] public int? MaxGraphemes { get; set; }
[JsonPropertyName("minGraphemes")] public int? MinGraphemes { get; set; }
// Integer-specific [JsonPropertyName("minimum")] public long? Minimum { get; set; }
[JsonPropertyName("maximum")] public long? Maximum { get; set; }
// Ref-specific [JsonPropertyName("ref")] public string? Ref { get; set; }
// Union-specific [JsonPropertyName("refs")] public List<string>? Refs { get; set; }
[JsonPropertyName("closed")] public bool? Closed { get; set; }
// Blob-specific [JsonPropertyName("accept")] public List<string>? Accept { get; set; }
[JsonPropertyName("maxSize")] public long? MaxSize { get; set; }
// Query/Procedure-specific [JsonPropertyName("parameters")] public LexiconDefinition? Parameters { get; set; }
[JsonPropertyName("input")] public LexiconIO? Input { get; set; }
[JsonPropertyName("output")] public LexiconIO? Output { get; set; }
[JsonPropertyName("errors")] public List<LexiconError>? Errors { get; set; }
// Subscription-specific [JsonPropertyName("message")] public LexiconMessage? Message { get; set; }}
/// <summary>/// Represents input/output schema for queries and procedures./// </summary>public sealed class LexiconIO{ [JsonPropertyName("description")] public string? Description { get; set; }
[JsonPropertyName("encoding")] public string Encoding { get; set; } = string.Empty;
[JsonPropertyName("schema")] public LexiconDefinition? Schema { get; set; }}
/// <summary>/// Represents an error definition./// </summary>public sealed class LexiconError{ [JsonPropertyName("name")] public string Name { get; set; } = string.Empty;
[JsonPropertyName("description")] public string? Description { get; set; }}
/// <summary>/// Represents a subscription message schema./// </summary>public sealed class LexiconMessage{ [JsonPropertyName("description")] public string? Description { get; set; }
[JsonPropertyName("schema")] public LexiconDefinition? Schema { get; set; }}