private void method_7(JsonContract jsonContract_0) { JsonContainerAttribute attribute = Class139.smethod_0(jsonContract_0.type_0); if (attribute != null) { jsonContract_0.IsReference = attribute.nullable_0; } else { DataContractAttribute attribute2 = Class139.smethod_5(jsonContract_0.type_0); if ((attribute2 != null) && attribute2.IsReference) { jsonContract_0.IsReference = true; } } jsonContract_0.Converter = this.ResolveContractConverter(jsonContract_0.type_0); jsonContract_0.JsonConverter_0 = JsonSerializer.smethod_1(ilist_0, jsonContract_0.type_0); if (Class194.smethod_6(jsonContract_0.CreatedType, true) || jsonContract_0.CreatedType.smethod_12()) { jsonContract_0.DefaultCreator = this.method_6(jsonContract_0.CreatedType); jsonContract_0.DefaultCreatorNonPublic = !jsonContract_0.CreatedType.smethod_12() && (Class194.smethod_7(jsonContract_0.CreatedType) == null); } this.method_8(jsonContract_0, jsonContract_0.type_0); }
private string method_2(Type type_0) { JsonContainerAttribute attribute = Class139.smethod_0(type_0); if ((attribute != null) && !string.IsNullOrEmpty(attribute.Title)) { return(attribute.Title); } return(null); }
internal JsonContainerContract(Type underlyingType) : base(underlyingType) { JsonContainerAttribute attribute = Class139.smethod_0(underlyingType); if (attribute != null) { if (attribute.ItemConverterType != null) { this.ItemConverter = JsonConverterAttribute.smethod_0(attribute.ItemConverterType); } this.ItemIsReference = attribute.nullable_1; this.ItemReferenceLoopHandling = attribute.nullable_2; this.ItemTypeNameHandling = attribute.nullable_3; } }
private string method_3(Type type_0) { JsonContainerAttribute attribute = Class139.smethod_0(type_0); if ((attribute != null) && !string.IsNullOrEmpty(attribute.Description)) { return(attribute.Description); } DescriptionAttribute attribute2 = Class194.smethod_29 <DescriptionAttribute>(type_0); if (attribute2 != null) { return(attribute2.Description); } return(null); }
private string method_4(Type type_0, bool bool_0) { JsonContainerAttribute attribute = Class139.smethod_0(type_0); if ((attribute != null) && !string.IsNullOrEmpty(attribute.Id)) { return(attribute.Id); } if (!bool_0) { switch (this.UndefinedSchemaIdHandling) { case Newtonsoft.Json.Schema.UndefinedSchemaIdHandling.UseTypeName: return(type_0.FullName); case Newtonsoft.Json.Schema.UndefinedSchemaIdHandling.UseAssemblyQualifiedName: return(type_0.AssemblyQualifiedName); } } return(null); }
private JsonSchema method_5(Type type_0, Required required_0, bool bool_0) { JsonConverter converter; Class134 class4 = new Class134 { type_0 = type_0 }; Class203.smethod_2(class4.type_0, "type"); string str = this.method_4(class4.type_0, false); string str2 = this.method_4(class4.type_0, true); if (!string.IsNullOrEmpty(str)) { JsonSchema schema = this.jsonSchemaResolver_0.GetSchema(str); if (schema != null) { if ((required_0 != Required.Always) && !smethod_0(schema.Type, JsonSchemaType.Null)) { schema.Type = ((JsonSchemaType)schema.Type) | JsonSchemaType.Null; } if (bool_0 && (schema.Required != true)) { schema.Required = true; } return(schema); } } if (this.ilist_0.Any <Class133>(new Func <Class133, bool>(class4.method_0))) { throw new JsonException("Unresolved circular reference for type '{0}'. Explicitly define an Id for the type using a JsonObject/JsonArray attribute or automatically generate a type Id using the UndefinedSchemaIdHandling property.".smethod_0(CultureInfo.InvariantCulture, class4.type_0)); } JsonContract contract = this.ContractResolver.ResolveContract(class4.type_0); if (((converter = contract.Converter) != null) || ((converter = contract.JsonConverter_0) != null)) { JsonSchema schema2 = converter.GetSchema(); if (schema2 != null) { return(schema2); } } this.method_0(new Class133(class4.type_0, new JsonSchema())); if (str2 != null) { this.JsonSchema_0.Id = str2; } if (bool_0) { this.JsonSchema_0.Required = true; } this.JsonSchema_0.Title = this.method_2(class4.type_0); this.JsonSchema_0.Description = this.method_3(class4.type_0); if (converter != null) { this.JsonSchema_0.Type = 0x7f; } else { switch (contract.enum15_0) { case Enum15.Object: this.JsonSchema_0.Type = new JsonSchemaType?(this.method_6(JsonSchemaType.Object, required_0)); this.JsonSchema_0.Id = this.method_4(class4.type_0, false); this.method_8(class4.type_0, (JsonObjectContract)contract); goto Label_04CD; case Enum15.Array: { this.JsonSchema_0.Type = new JsonSchemaType?(this.method_6(JsonSchemaType.Array, required_0)); this.JsonSchema_0.Id = this.method_4(class4.type_0, false); JsonArrayAttribute attribute = Class139.smethod_0(class4.type_0) as JsonArrayAttribute; bool flag = (attribute == null) || attribute.AllowNullItems; Type type = Class194.smethod_18(class4.type_0); if (type != null) { this.JsonSchema_0.Items = new List <JsonSchema>(); this.JsonSchema_0.Items.Add(this.method_5(type, !flag ? Required.Always : Required.Default, false)); } goto Label_04CD; } case Enum15.Primitive: this.JsonSchema_0.Type = new JsonSchemaType?(this.method_10(class4.type_0, required_0)); if (((((JsonSchemaType)this.JsonSchema_0.Type) == JsonSchemaType.Integer) && class4.type_0.smethod_7()) && !class4.type_0.IsDefined(typeof(FlagsAttribute), true)) { this.JsonSchema_0.Enum = new List <JToken>(); foreach (Class187 <long> class3 in Class186.smethod_2 <long>(class4.type_0)) { JToken item = JToken.FromObject(class3.Prop_0); this.JsonSchema_0.Enum.Add(item); } } goto Label_04CD; case Enum15.String: { JsonSchemaType type2 = !Class194.smethod_9(contract.UnderlyingType) ? JsonSchemaType.String : this.method_6(JsonSchemaType.String, required_0); this.JsonSchema_0.Type = new JsonSchemaType?(type2); goto Label_04CD; } case Enum15.Dictionary: Type type3; Type type4; this.JsonSchema_0.Type = new JsonSchemaType?(this.method_6(JsonSchemaType.Object, required_0)); Class194.smethod_19(class4.type_0, out type3, out type4); if ((type3 != null) && (this.ContractResolver.ResolveContract(type3).enum15_0 == Enum15.Primitive)) { this.JsonSchema_0.AdditionalProperties = this.method_5(type4, Required.Default, false); } goto Label_04CD; case Enum15.Dynamic: case Enum15.Linq: this.JsonSchema_0.Type = 0x7f; goto Label_04CD; case Enum15.Serializable: this.JsonSchema_0.Type = new JsonSchemaType?(this.method_6(JsonSchemaType.Object, required_0)); this.JsonSchema_0.Id = this.method_4(class4.type_0, false); this.method_9(class4.type_0, (JsonISerializableContract)contract); goto Label_04CD; } throw new JsonException("Unexpected contract type: {0}".smethod_0(CultureInfo.InvariantCulture, contract)); } Label_04CD: return(this.method_1().JsonSchema_0); }