This repository was archived by the owner on Jan 14, 2024. It is now read-only.
[SW-502] Fixed SDK, added a working schema.json from vim-sw PHP SDK#8
Open
mborodov wants to merge 1 commit intoshyim:masterfrom
Open
[SW-502] Fixed SDK, added a working schema.json from vim-sw PHP SDK#8mborodov wants to merge 1 commit intoshyim:masterfrom
mborodov wants to merge 1 commit intoshyim:masterfrom
Conversation
mborodov
commented
Nov 3, 2022
| this.url = url; | ||
| this.client = createClient(url, token, version) | ||
| this.version = version; | ||
| this.schema = require('./data/schema.json') |
Author
There was a problem hiding this comment.
Now we load the schematic from the local file
mborodov
commented
Nov 3, 2022
|
|
||
| Object.keys(schema.data).forEach((entityName) => { | ||
| this.EntityDefinition.add(entityName, schema.data[entityName]); | ||
| Object.keys(this.schema).forEach((entityName) => { |
Author
There was a problem hiding this comment.
Small refactor. data subkey is not exist in the new schema file.
mborodov
commented
Nov 3, 2022
| return new Repository( | ||
| route, | ||
| definition.entity, | ||
| entityName, |
Author
There was a problem hiding this comment.
Previously definition.entity returned null. Changed to another variable.
mborodov
commented
Nov 3, 2022
| export function createClient(url, token, version) { | ||
| const client = axios.create({ | ||
| baseURL: `${url}/api/v${version}` | ||
| baseURL: `${url}/api` |
mborodov
commented
Nov 3, 2022
| getPrimaryKeyFields() { | ||
| return this.filterProperties((property) => { | ||
| return property.flags.primary_key === true; | ||
| return property.flags.primary === true; |
Author
There was a problem hiding this comment.
Now primary field called 'primary' in the new schema.json
mborodov
commented
Nov 3, 2022
| Accept: 'application/vnd.api+json', | ||
| Authorization: `Bearer ${context.authToken.access}`, | ||
| 'Content-Type': 'application/json', | ||
| 'sw-api-compatibility': compatibility |
Author
There was a problem hiding this comment.
Removed, otherwise there was a cors error
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.