@protocol HUBJSONSchema <NSObject>
Protocol defining the public API of an object describing a JSON schema for use in the Hub Framework
You don’t conform to this protocol yourself, instead you retrieve an instance conforming to it from
HUBJSONSchemaRegistry used by the application’s
HUBJSONSchema comes 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.
HUBJSONSchema consists of several sub-schemas, one for each model. The schemas may be individually
customized. See their respective documentation for more info on how to customize them.
The Hub Framework uses a path-based approach to JSON parsing, that enables the API user to describe how to
retrieve data from a JSON structure using paths - sequences of operations that each perform a JSON parsing task,
such as going to a key in a dictionary, or iterating over an array. To customize a path, you can either change
it directly, or replace it with a new one created from this schema’s
Perform a deep copy of this schema, returning a new instance that has the exact same paths as this one
- (nonnull id<HUBJSONSchema>)copy;
Return a view model created by extracting data from a given JSON dictionary, using this schema
In production code, you normally don’t have to use this API, since the Hub Framework will take care of building view models from both JSON and local content operation code for you. However, this API is very useful in tests, when you want to assert that any custom schema that you’re using acts the way you expect it to.
- (nonnull id<HUBViewModel>)viewModelFromJSONDictionary: (nonnull NSDictionary<NSString *, NSObject *> *)dictionary;
The JSON dictionary to extract data from