Make file paths in JSON schema fixtures to be root-based
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
We have to use relative paths in JSON schema fixture files. They can become too long and hard to manage when an EE-specific entity refers to FOSS entity. An example from ee/spec/fixtures/api/schemas/public_api/v4/epic_issue_link.json:
{
"type": "object",
"properties" : {
"id": { "type": "integer" },
"relative_position": { "type": "integer" },
"issue": { "type": "object" },
"epic": {
"allOf": [
{ "$ref": "./epic.json" }
]
},
"issue": {
"allOf": [
{ "$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/issue.json" },
{
"properties": {
"weight": { "type": ["integer", "null"] }
}
}
]
}
},
"required" : [ "id", "epic", "issue", "relative_position" ],
"additionalProperties": false
}
Proposal
We need to make this more manageable, for instance, via introducing a $root alias and intercept it at the JSON schema validator level (used by match_response_schema RSpec matcher):
{ "$ref": "$root/spec/fixtures/api/schemas/public_api/v4/issue.json" }
Edited by 🤖 GitLab Bot 🤖