internal static bool ShouldBeEnum( this JsonSchema schema, string typeName, string propertyName, HintDictionary hintDictionary, out EnumHint enumHint) { enumHint = null; if (hintDictionary == null) { return(false); } enumHint = hintDictionary.GetPropertyHint <EnumHint>(typeName, propertyName); if (enumHint != null) { if (string.IsNullOrWhiteSpace(enumHint.TypeName)) { throw Error.CreateException( Resources.ErrorEnumHintRequiresTypeName, typeName, propertyName); } return(true); } return(false); }
internal static bool ShouldBeDictionary( this JsonSchema schema, string typeName, string propertyName, HintDictionary hintDictionary, out DictionaryHint dictionaryHint) { dictionaryHint = null; // Ignore any DictionaryHint that might apply to this property // if the property is not an object. if (schema.SafeGetType() != SchemaType.Object) { return(false); } // Is there a DictionaryHint that targets this property? if (hintDictionary == null) { return(false); } dictionaryHint = hintDictionary.GetPropertyHint <DictionaryHint>(typeName, propertyName); if (dictionaryHint == null) { return(false); } return(true); }