0

We have the following situation: In our API we can eager load other projects like this /user?includes=projects this results in a nested response

{
  "name": "John",
  ...
  "projects": [
    {
      "title": "Example"
      ... 
    }
  ]
}

If we call the endpoint without the includes /user the response does not include the projects

{
  "name": "John",
  ...
}

How would you document this in OpenAPI 3?

dschniepp
  • 1,083
  • 12
  • 19
  • `projects` is an optional property of the User schema. See [How to define nested objects](https://stackoverflow.com/q/35955243/113116) and [How to specify if a field is optional or required?](https://stackoverflow.com/q/40113049/113116). – Helen Dec 17 '19 at 13:26
  • @Helen thank you. I am aware of the required field. But code generation wise this would lead to validation rules for the `project` attribute. – dschniepp Dec 17 '19 at 15:02

0 Answers0