Open kempspo opened 3 years ago
yes it would be great.
@kempspo What kind of abstraction would make sense to you? Do you have an interface example you would prefer?
To be honest, I don't have a specific opinion on how it should go, but I would think maybe some function like pr_add_schema
that takes a Plumber API object, a name and a list that holds the schema object definition (I honestly don't know how to make this simpler for people to use).
I think a way to refer to the schema from the pr_handle
set of functions would also be helpful?
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
Would be useful to be able to define the schema of our objects, like so. Found it particularly hard to communicate POST body request formats without having to talk to other devs directly and figure out how it was built.
Definitely doable by manually appending to the API spec via
pr_set_api_spec
, but having function to abstract this away from people would be great.