HUBComponentModelJSONSchema
@protocol HUBComponentModelJSONSchema <NSObject>
Protocol defining the public API of a JSON schema used to extract data for a HUBComponentModel
You don’t conform to this protocol yourself, instead an object conforming to it will come attached
when you create a HUBJSONSchema
(see its documentation for more info). The implementation of this
protocol will come setup according to the default Hub Framework JSON schema, but you’re free to change
& extend it to fit any schema that you expect your JSON data to conform to.
A schema is defined as a collection of paths, that each describe the operations required to extract
a certain piece of data from a JSON structure. For a more in-depth description on how paths work, see the
documentation for HUBJSONPath
and HUBMutableJSONPath
. For more information about the properties that
the data extractd using this schema will be used for, see HUBComponentModel
.
To change a path - either create a mutableCopy
of it, change it, and re-assign it back to its property,
or create a new path from scratch using HUBJSONSchema
.
All paths in this schema are relative to a JSON dictionary defining component model data.
-
The path to follow to extract a component model identifier. Maps to
identifier
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull identifierPath;
-
The path to follow to extract a component group identifier. Maps to
groupIdentifier
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull groupIdentifierPath;
-
The path to follow to extract a component identifier. Maps to
componentIdentifier
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull componentIdentifierPath;
-
The path to follow to extract a component category. Maps to
componentCategory
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull componentCategoryPath;
-
The path to follow to extract a title. Maps to
title
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull titlePath;
-
The path to follow to extract a subtitle. Maps to
subtitle
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull subtitlePath;
-
The path to follow to extract an accessory title. Maps to
accessoryTitle
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull accessoryTitlePath;
-
The path to follow to extract a description text. Maps to
descriptionText
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull descriptionTextPath;
-
The path to follow to extract image data for a component’s main image. Maps to
mainImageData
.The dictionary extracted by following this path will then be parsed using
HUBComponentImageDataJSONSchema
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull mainImageDataDictionaryPath;
-
The path to follow to extract image data for a component’s background image. Maps to
backgroundImageData
.The dictionary extracted by following this path will then be parsed using
HUBComponentImageDataJSONSchema
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull backgroundImageDataDictionaryPath;
-
The path to follow to extract a dictionary of image data for a component’s custom images. Maps to
customImageData
.The dictionaries contained in the dictionary extracted by following this path will then be parsed using
HUBComponentImageDataJSONSchema
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull customImageDataDictionaryPath;
-
The path to follow to extract an icon identifier for the component. Maps to
iconIdentifier
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONStringPath> _Nonnull iconIdentifierPath;
-
The path to follow to extract a dictionary to use to construct a target for the component. Maps to
target
.The dictionary extracted by following this path will then be parsed using
HUBComponentTargetJSONSchema
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull targetDictionaryPath;
-
The path to follow to extract any metadata for the component model. Maps to
metadata
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull metadataPath;
-
The path to follow to extract any logging data for a component. Maps to
loggingData
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull loggingDataPath;
-
The path to follow to extract any custom data for a component. Maps to
customData
.Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull customDataPath;
-
The path to follow to extract dictionaries to create child component models from. Maps to
children
.The dictionaries extracted by following this path will then be parsed recursively by this schema.
Declaration
Objective-C
@property (readwrite, strong, nonatomic) id<HUBJSONDictionaryPath> _Nonnull childDictionariesPath;
-
Create a copy of this schema, with the same paths
Declaration
Objective-C
- (nonnull id<HUBComponentModelJSONSchema>)copy;