express-openapi-validator
express-openapi-validator copied to clipboard
readOnly in $ref: is ignored
Describe the bug when using readOnly:true inside a $ref: then the readOnly:true attribute is ignored (i.e. the attribute is enforced for post/put requests)
To Reproduce Have a required attribute that receives its definition via a $ref. The definition must include readOnly: true
Actual behavior The read only attribute is ignored
Expected behavior A post/put request omitting the attribute should pass validation A post/put request containing the attribute should fail validation (atrribute is read only)
Examples and context
Using the following psudo spec triggers the problem
genericReadOnlyId:
type: string
title: ID
readOnly: true
someObject:
type: object
required:
- id
properties
id:
$ref: "#/genericReadOnlyId"