Please take a look at the Screenshot #1. For me this feels like a pretty obvious use case - to be able to have referenced element as readonly/writeonly in the context of the schema that references it.
The lack of it limits usage of components drastically, at least in our APIs. I have to create a new copy of a schema just to mark the same object as readonly in few contexts.
Please consider at least supporting a manual entry (Screenshot #2)
For example, in our API we have a common way to represent internationalized content. For example, let’s say I have a Post and it has title, slug and body:
So, i’ve created a schema like this (it’s more complicated, i left only what is relevant here) to describe such structure, let’s call it LocalizedContent:
However, It does not make sense to set “readOnly” property on this schema globally, as some model attributes are readonly, and some are not - for example Post has editable title and body, but slug is autogenerated
In other words, when i reference LocalizedContent on Post’s attributes, I need to specify that slug is readonly. Without it, I would have to create a “readonly” version of this schema ([READONLY] LocalizedContent :D) or just copy-paste it without reference.
The example above may feel a bit complicated and specific to just one case, but because of the same issue, we cannot fully efficiently use “primitives” like these that make the whole API specs more clean and DRY:
For example, in our API we have a common way to represent internationalized content. For example, let’s say I have a Post and it has title, slug and body:
So, i’ve created a schema like this (it’s more complicated, i left only what is relevant here) to describe such structure, let’s call it LocalizedContent:
However, It does not make sense to set “readOnly” property on this schema globally, as some model attributes are readonly, and some are not - for example Post has editable title and body, but slug is autogenerated
In other words, when i reference LocalizedContent on Post’s attributes, I need to specify that slug is readonly. Without it, I would have to create a “readonly” version of this schema ([READONLY] LocalizedContent :D) or just copy-paste it without reference.
We actually have a similar use case where we reference Schema in our requests model, but for the “PATCH” operation on another service, we only want the “write” options to show of that service, not it’s relation. However, with the schema referencing another “entity” that is actually managed by another endpoint/service, it looks as if you can “update” fields of that entity even though it’s not possible.
In other words, allowing for the “read-only” of referencing another schema for a field should make that field not “updateable” in the API requests definition of method that update a Schema.
Thank you for your detailed feedback and use case explanation! I’ll share your requirements with our product team for evaluation. We’ll keep you updated on any progress regarding this feature.