I am trying to re-use component schemas as reference which vary based on their usage.
I have a "Employee Model" that will contain say below items:- EmployeeID and EmployeeName
So I have created a component schema in YAML like below:-
components:
schemas:
Employee:
type: object
properties:
EmployeeID:
type: integer
EmployeeName:
type: string
EmployeeAge:
type: integer
Now I want to use this in multiple paths like
- Use this in both request and response body, but with the caveat that in the request I should only take in the ID and response can hold all.
- Use this in the response body but only with Name and Age
- Use this in a request body with only Name
Can you please recommend the best approach to use $ref and achieve the above?