MockComposition class
Resolves mock JSON documents that use $extends and $merge.
File shape:
{
"$extends": "mocks/base.mock.json",
"getDevices": {
"$merge": {
"body.status[0].Active": false
}
}
}
$extends may be a string or a list of mock file paths (merged in order).
$merge applies path updates onto the extended/current response for that API.
Without $merge, an API entry fully replaces the previous response.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
applyMergePaths(
Map< String, dynamic> target, Map<String, dynamic> paths, {required String sourceLabel, required String apiName}) → void -
deepCopy(
dynamic value) → dynamic -
mergeApiMaps(
Map< String, Map< target, Map<String, dynamic> >String, Map< incoming, {required String sourceLabel}) → voidString, dynamic> > -
Merges
incomingintotarget. Entries with$mergepatch the existing API response; all other entries replace it. -
parseApiResponse(
Map< String, dynamic> map, {required String sourceLabel, required String apiName}) → MockAPIResponse -
parsePath(
String path) → List< Object> -
resolveDocument(
Map doc, {required String sourceLabel, required String testAssetPath, required Future< String> assetLoader(String assetPath), required String resolveAssetPath(String fromAssetPath, String relativePath), Set<String> ? resolving}) → Future<Map< String, Map< >String, dynamic> > - Resolves a mock document map (file root or inline layer) into API maps.
-
resolveFile(
{required String testAssetPath, required String mockFilePath, required Future< String> assetLoader(String assetPath), required String resolveAssetPath(String fromAssetPath, String relativePath), Set<String> ? resolving}) → Future<Map< String, Map< >String, dynamic> > -
Loads and fully resolves a mock file into API response maps
(
statusCode/body/headers/delayMs/responses). -
setPath(
Map< String, dynamic> root, String path, dynamic value) → void -
Sets
valueat a dotted/bracket path or JSON Pointer. -
toMockApis(
Map< String, Map< raw, {required String sourceLabel}) → Map<String, dynamic> >String, MockAPIResponse>
Constants
- extendsKey → const String
- mergeKey → const String