Fix validation for readOnly $ref properties
- Dominant language
- TypeScript
- Stars
- 104
- Forks
- 62
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 5
Description
The "readOnly" keyword of `$ref` properties is ignored by oav validation process.
*Full context:*
My team and I are developing a new RP via RPaaS and we have RPaaS validation enabled. We expect read-only properties that are sent as part of the request to be discarded. Instead, if they are defined with the `$ref` keyword (see example below), they go through and override the existing values of these properties in RPaaS database.
I might be wrong, but I heard that RPaaS are using oav tools to perform their validation task (including the removal of read-only fields from the request body). Is this true? If it is, can this be fixed? Thanks in advance.
Example of a property defined with the `$ref` keyword:
```json
"systemData": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData",
"description": "Azure Resource Manager metadata containing createdBy and modifiedBy information",
"readOnly": true // This is ignored by oav
}
```
Contributor guide
Research direction
No source file or test is named. Start by tracing request validation for referenced properties in the TypeScript code, then add a regression case for a $ref property with readOnly: true and verify that the field is removed from the request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100