Open
Conversation
- rename JSON_API_SOURCE into JSON_API_RESOURCE - implement rio.registerResourceType - improve resource configuration merge and override algorithm - refactor JsonApiStandardizer into class - fix tests based on changes
vedrani
commented
Jul 23, 2018
| const rsaaConfig = buildRSAAConfig(config); | ||
| const endpoint = buildEndpoint(rsaaConfig.endpoint, params, options); | ||
| const source = _.get(config, 'request.resourceType', JSON_API_SOURCE); | ||
| const source = _.get(config, 'request.resourceType', JSON_API_RESOURCE); |
Contributor
Author
There was a problem hiding this comment.
Support config.type also.
| endpoint, | ||
| options, | ||
| source: config.request.resourceType || JSON_API_SOURCE, | ||
| source: config.request.resourceType || JSON_API_RESOURCE, |
Contributor
Author
There was a problem hiding this comment.
Same, config.type. Use _.get
| schema, | ||
| tag, | ||
| source: JSON_API_SOURCE, | ||
| source: JSON_API_RESOURCE, |
Contributor
Author
There was a problem hiding this comment.
Support for other formats.
| const standardizer = rio.getStandardizer(sourceAction.meta.source); | ||
| // transforms item into standard model | ||
| const transformation = transform(item); | ||
| const transformation = standardizer.transform(item); |
Contributor
Author
There was a problem hiding this comment.
What if standardizer is null?
|
|
||
| // finds appropriate standardizer for transformation | ||
| const transform = rio.getStandardizer(sourceAction.meta.source); | ||
| const standardizer = rio.getStandardizer(sourceAction.meta.source); |
Contributor
Author
There was a problem hiding this comment.
Extract meta.source
| const resourceTypeConfig = this.getResourceType(resourceType); | ||
|
|
||
| const resolvedConfig = _.merge({}, resourceTypeConfig, config); | ||
| validateResourceConfig(resolvedConfig); |
|
|
||
| /** | ||
| * Register source type for data standardization. | ||
| * Register register type for data. |
| this.standardizers[sourceType] = standardizer; | ||
| validateResourceTypeConfig(config); | ||
| this.resourceTypeConfigs[type] = Object.freeze(config); | ||
|
|
| if (!_.has(object, 'relationships')) { | ||
| return { | ||
| schema: {}, | ||
| object: _.cloneDeep(object), |
Contributor
Author
There was a problem hiding this comment.
Do we need to cloneDeep?
| relationships, | ||
| type: resolveType(object), | ||
| }, | ||
| object: _.cloneDeep(object), |
Contributor
Author
There was a problem hiding this comment.
Do we need to cloneDeep?
- remove deepClone from code, use Object.freeze
- resource object with registered actions - partially supported actions with dot notation - implement execute generic action - migrate find, create to execute action - implement partial tests for execute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.