Hello everyone,
It has been a while since I visited Swagger Hub. Now I revisited our API and it happens to be full of errors of this type:
Resolver error
Cannot read property 'properties' of undefined
I have stripped down the API to just what is necessary to reproduce the issue. See https://app.swaggerhub.com/api/yonadev/YonaAppService/1.0.0
Does anybody know what's wrong with this? One of the ways to get rid of the issue is to remove the last two lines, but that's obviously not what I want.
Your help is appreciated!
Regards,
Bert
Solved! Go to Solution.
Hi Bert,
The error is here:
PrivateUserData: allOf: - $ref: '#/definitions/PrivateUserDataNoVPN' properties: vpnProfile: $ref: '#/definitions/VPNProfile'
It should be:
PrivateUserData: allOf: - $ref: '#/definitions/PrivateUserDataNoVPN' - type: object
properties: vpnProfile: $ref: '#/definitions/VPNProfile'
Also, there's no need for allOf in other schemas:
PostPutUser: $ref: '#/definitions/PrivateUserData' VPNProfile: type: object description: VPN profile. Private data, only available after the mobile number is confirmed. properties: _links: $ref: '#/definitions/OvpnProfileLink'
If you want to combine multiple definitions, you have to use 'allOf'.
_links: allOf: - $ref: '#/definitions/Curies' - $ref: '#/definitions/SelfLink' - $ref: '#/definitions/EditLink' - $ref: '#/definitions/WeeklyActivityReportsLink' - $ref: '#/definitions/DailyActivityReportsLink'
That ^ would be the right approach in this case.
Hi Bert,
The error is here:
PrivateUserData: allOf: - $ref: '#/definitions/PrivateUserDataNoVPN' properties: vpnProfile: $ref: '#/definitions/VPNProfile'
It should be:
PrivateUserData: allOf: - $ref: '#/definitions/PrivateUserDataNoVPN' - type: object
properties: vpnProfile: $ref: '#/definitions/VPNProfile'
Also, there's no need for allOf in other schemas:
PostPutUser: $ref: '#/definitions/PrivateUserData' VPNProfile: type: object description: VPN profile. Private data, only available after the mobile number is confirmed. properties: _links: $ref: '#/definitions/OvpnProfileLink'
Thanks Helena. That removes the errors. I tried removing the allOf in other places, but that gives new errors.
For instance, I try to change this (line 2280):
_links: allOf: - $ref: '#/definitions/Curies' - $ref: '#/definitions/SelfLink' - $ref: '#/definitions/EditLink' - $ref: '#/definitions/WeeklyActivityReportsLink' - $ref: '#/definitions/DailyActivityReportsLink'
Into that:
_links: $ref: '#/definitions/Curies' $ref: '#/definitions/SelfLink' $ref: '#/definitions/EditLink' $ref: '#/definitions/WeeklyActivityReportsLink' $ref: '#/definitions/DailyActivityReportsLink'
I get:
Parser error
duplicated mapping key
Any idea?
If you want to combine multiple definitions, you have to use 'allOf'.
_links: allOf: - $ref: '#/definitions/Curies' - $ref: '#/definitions/SelfLink' - $ref: '#/definitions/EditLink' - $ref: '#/definitions/WeeklyActivityReportsLink' - $ref: '#/definitions/DailyActivityReportsLink'
That ^ would be the right approach in this case.
That explains it. Thank you!
Subject | Author | Latest Post |
---|---|---|