-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: support extensions
in utoipa::path
macro
#1228
Comments
This is exactly what I need. 👍 |
I got to a working version locally [in a branch]. Happy to push the branch for discussion - but currently I am not authorized.
or is it better to go with the following route (more similar to security):
PS: I have used the first one to date.
|
Great idea, there are people coming into this same case whether it is for adding extensions to the path or to the responses. Currently it is quite convoluted TBH since it requires you to manually edit the I am fine with either one of the approaches, perhaps the second one is better since there are few cases where this kind of style is used thus it would be familiar and would not "break the norm" inside the utoipa. The |
Related #1255 |
Do you have docs on how to do this now? |
@theswerd Nope, there are no docs about it, but regardless of using let mut api = ApiDoc::openapi();
let path_item = api.paths.paths.get_mut("/endpoint").expect("Paths must have endpoint");
let extensions = path_item.extensions.get_or_insert(Extensions::builder().build());
extensions.insert("x-extension".to_string(), serde_json::json!("value")); Extensions in docs: https://docs.rs/utoipa/latest/utoipa/openapi/extensions/struct.Extensions.html |
Hi,
I am only recently getting into openapi, having used rust for a little while. This project is great - started without any issue and got up and running in a very short amount of time.
I am currently working on an api to be hosted on AWS API Gateway and would like to use the extensions - implemented in #1104 - but by defining them via path macros rather than altering the
OpenApi
struct after the fact.I am happy to work on it (actually already started to look at it) - but will need an expert eye on it as I am likely to be missing stuff.
My aim is to extend the
path
macros to support something like the following:Essentially, add an additional path attribute "extensions" that takes a list of individually defined extensions, each with a unique key/property. In a first pass, I would limit the value to a specified json - but maybe later could look at defining these separately to avoid repeat.
Is this something of interest that is not already being tackled elsewhere (or implemented in a way that I was not aware of)?
Is it ok for me to contribute? Is there guidelines to follow when contributing [I am fine with the license side]? I am familiar with github/PR/testing/documentation side but not the specific of this project.
Thanks for reading.
The text was updated successfully, but these errors were encountered: