Is there any plan to add Generic, Pick, Omit and other TypeScript like features? #3406
Replies: 1 comment 1 reply
-
This is a JSON Schema question rather than an OpenAPI question, so you might want to raise it with them or consider proposing an extension vocabulary. OpenAPI 3.1 made a point to be more compatible with standard JSON Schema, with fewer custom extensions, and OpenAPI 4.0 will be more loosely coupled with content schema formats. So this request is out of scope for this project. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In TS if you want to $ref specific properties from a Schema, it's a pain, at least from what I understood.
For example:
As you can see, there is a relation between Permission and Role. But Role shouldn't include all of the Permission properties, just part of them. Imagine if Permission or other embedded Schemas had 50 properties, this could lead to big issue.
**
Moreover, if we want to make it even more tricky, in a real life production API, we have different kinds of the same Schema, for example: when creating a new Permission we should never provide id. If someone provides id we want to deny the request. When updating a Permission, we can only update the info, but never the key.
When returning a Permission in a GET request, we would like to return the entire Permission, but without the metadata (which is basically some system info).
Any advices here?
Beta Was this translation helpful? Give feedback.
All reactions