Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Framework/Framework.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
37EEF9211D9E85E600AC52B6 /* Array-length.json in Resources */ = {isa = PBXBuildFile; fileRef = 37EEF9201D9E85E600AC52B6 /* Array-length.json */; };
37EEF9231D9E8E9F00AC52B6 /* Array-uniqueness.json in Resources */ = {isa = PBXBuildFile; fileRef = 37EEF9221D9E8E9F00AC52B6 /* Array-uniqueness.json */; };
37EEF9251D9EDBC700AC52B6 /* Combination-allOf1.json in Resources */ = {isa = PBXBuildFile; fileRef = 37EEF9241D9EDBC700AC52B6 /* Combination-allOf1.json */; };
37EEF9321D9EF35400AC52B6 /* Helpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 37EEF9311D9EF33100AC52B6 /* Helpers.framework */; };
37EEF9431D9F09F400AC52B6 /* Combination-allOf2.json in Resources */ = {isa = PBXBuildFile; fileRef = 37EEF9421D9F09F400AC52B6 /* Combination-allOf2.json */; };
37EEF9451D9F0DCC00AC52B6 /* Combination-anyOf.json in Resources */ = {isa = PBXBuildFile; fileRef = 37EEF9441D9F0DCC00AC52B6 /* Combination-anyOf.json */; };
37EEF9471D9F1CE200AC52B6 /* Combination-oneOf1.json in Resources */ = {isa = PBXBuildFile; fileRef = 37EEF9461D9F1CE200AC52B6 /* Combination-oneOf1.json */; };
Expand Down Expand Up @@ -111,7 +110,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
37EEF9321D9EF35400AC52B6 /* Helpers.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
13 changes: 8 additions & 5 deletions Framework/Framework/JSONSchema.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
//

#import "JSONSchema.h"
#import <Helpers/Helpers.h>

#import <objc/runtime.h>

static NSString *const JSONExtension = @"json";

static NSString *const JSONFragment = @"#";
static NSString *const JSONRoot = @"/";
Expand Down Expand Up @@ -1082,7 +1085,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary {
isSpec = [identifier isEqualToString:schema];
if (!isSpec) {

NSURL *URL = [self.bundle URLForResource:JSONSchemaDraftV4.stringByDeletingLastPathComponent.lastPathComponent withExtension:ExtensionJSON];
NSURL *URL = [[NSBundle bundleForClass:self.class] URLForResource:JSONSchemaDraftV4.stringByDeletingLastPathComponent.lastPathComponent withExtension:JSONExtension];
NSData *data = [NSData dataWithContentsOfURL:URL];

if (![schema isEqualToString:JSONSchemaDraftV4]) {
Expand Down Expand Up @@ -1288,7 +1291,7 @@ + (void)validate:(id)o type:(NSString *)ot withSchema:(id)s schemaType:(NSString

+ (NSError *)errorWithDescription:(NSString *)description {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[NSLocalizedDescriptionKey] = [self.bundle localizedStringForKey:description value:description table:JSONErrorsTable];
userInfo[NSLocalizedDescriptionKey] = [[NSBundle bundleForClass:self.class] localizedStringForKey:description value:description table:JSONErrorsTable];
NSError *error = [NSError errorWithDomain:JSONErrorDomain code:0 userInfo:userInfo];
return error;
}
Expand Down Expand Up @@ -1466,7 +1469,7 @@ - (NSString *)resolvedType {

- (NSError *)errorWithDescription:(NSString *)description atPath:(NSString *)path {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[NSLocalizedDescriptionKey] = [self.bundle localizedStringForKey:description value:description table:JSONErrorsTable];
userInfo[NSLocalizedDescriptionKey] = [[NSBundle bundleForClass:self.class] localizedStringForKey:description value:description table:JSONErrorsTable];
userInfo[NSFilePathErrorKey] = path;
NSError *error = [NSError errorWithDomain:JSONErrorDomain code:0 userInfo:userInfo];
return error;
Expand All @@ -1486,7 +1489,7 @@ - (NSError *)errorWithDescription:(NSString *)description atPath:(NSString *)pat
@implementation NSObject (JSONSchema)

+ (JSONSchema *)JSONSchemaNamed:(NSString *)name {
NSURL *URL = [self.bundle URLForResource:name withExtension:ExtensionJSON];
NSURL *URL = [[NSBundle bundleForClass:self.class] URLForResource:name withExtension:JSONExtension];
JSONSchema *schema = [JSONSchema.alloc initWithURL:URL];
NSAssert(schema, name);
return schema;
Expand Down
3 changes: 1 addition & 2 deletions JSONSchema.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,5 @@ Pod::Spec.new do |s|

# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency "JSONKit", "~> 1.4"
s.dependency "Helpers"


end