BentoML icon indicating copy to clipboard operation
BentoML copied to clipboard

feature: make it easier to override / set fields in the openapi docs

Open creativedutchmen opened this issue 1 year ago • 3 comments

Feature request

I would like if I could set details that are relevant to our organisation in the openapi docs for my models (contact information, summary, git link) without having to wrap the bento in another API.

Motivation

When consumers of my API visit the docs for my deployed models, they don't care that I used BentoML to deploy the model - they want to know what the model does, how to use it and who to contact if they run into issues.

Some of the fields in the docs can be overwritten, but the GitHub link on the top right, the summary (A ML Service created with BentoML) and contact Contact(name="BentoML Team", email="[email protected]") are hardcoded without an easy way to set them myself.

The only way to change this behaviour now is to override the openapi_spec property and set those fields manually - which is fragile and cumbersome. It would be great if we could take these values from the bentofile instead.

Other

No response

creativedutchmen avatar Sep 08 '22 07:09 creativedutchmen

I think it is a great idea for user to override these fields. However, I'm a bit more hesistant for putting this into bentofile.yaml

FastAPI does allow user to extend OpenAPI, but I think if we want to design this feature we would probably will provide a Python API for this. What do you think?

aarnphm avatar Sep 08 '22 07:09 aarnphm

We already allow some of it to be overwritten in the bentofile though, by setting description for instance, so having it in one place makes sense to me.

But yeah, if the goal is to allow much more customisation, then python is the way to go. (I would love to be able to replace the BentoML docs with a version that doesn't include google tag manager, for instance)

creativedutchmen avatar Sep 08 '22 08:09 creativedutchmen

I believe this would be also a great features for community contribution. I would love to help you with desigining this if you are interested in contributing. We also have #2900 that also touches a bit of OpenAPI.

Would love to chat more on slack. But also feel free to discuss here as well 😃

aarnphm avatar Sep 08 '22 08:09 aarnphm