When you build an API, please start with the OpenAPI specification, before you write any code for your API.
It can be iterative, but for every part, just start with the OpenAPI, and think about what you want from the API, what do you want to send, and what to receive.<p>It is like the TDD approach, design before build.<p>Writing or generating tests after you build the code, is the same as this.
It is guessing what it should do.
The OpenAPI specification, and the tests should tell you what it should do, not the code.<p>If you have the specification, everyone (and also AI) can write the code for you to make it work.
But the specification is about what you think it should do.
That are the questions and requirements that you have about the system.