-
Notifications
You must be signed in to change notification settings - Fork 5
[SW-502] Fixed SDK, added a working schema.json from vim-sw PHP SDK #8
base: master
Are you sure you want to change the base?
Conversation
| this.url = url; | ||
| this.client = createClient(url, token, version) | ||
| this.version = version; | ||
| this.schema = require('./data/schema.json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we load the schematic from the local file
|
|
||
| Object.keys(schema.data).forEach((entityName) => { | ||
| this.EntityDefinition.add(entityName, schema.data[entityName]); | ||
| Object.keys(this.schema).forEach((entityName) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small refactor. data subkey is not exist in the new schema file.
| return new Repository( | ||
| route, | ||
| definition.entity, | ||
| entityName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously definition.entity returned null. Changed to another variable.
| export function createClient(url, token, version) { | ||
| const client = axios.create({ | ||
| baseURL: `${url}/api/v${version}` | ||
| baseURL: `${url}/api` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed version from URL
| getPrimaryKeyFields() { | ||
| return this.filterProperties((property) => { | ||
| return property.flags.primary_key === true; | ||
| return property.flags.primary === true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now primary field called 'primary' in the new schema.json
| Accept: 'application/vnd.api+json', | ||
| Authorization: `Bearer ${context.authToken.access}`, | ||
| 'Content-Type': 'application/json', | ||
| 'sw-api-compatibility': compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, otherwise there was a cors error
No description provided.