Skip to content
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

Provide optional URL prefix to generated spec json #470

Closed
VersBinarii opened this issue Dec 28, 2022 · 3 comments
Closed

Provide optional URL prefix to generated spec json #470

VersBinarii opened this issue Dec 28, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@VersBinarii
Copy link
Contributor

VersBinarii commented Dec 28, 2022

Description of the feature

Would you consider adding an option to pass in url prefix into the generated spec?

"paths" : {
    "/my_prefix/rest/of/my/path" : {
      "get" : {
        "parameters" : [
          {
            "name" : "X-Customheader",
            "in" : "header",
            "required" : true,
            "schema" : {
              "type" : "string"
             }
           }
         ]
      }
    ... snip ...
 

Code example (if possible)

Maybe something like that:

let spec_options = SpecOptions::default().with_url_prefix("/my_prefix");
let my_api_schema = my_api.spec_endpoint_with_options(options);
@VersBinarii VersBinarii added the enhancement New feature or request label Dec 28, 2022
@sunli829
Copy link
Collaborator

Maybe it can be solved with prefix_path attribute.

#[OpenApi(prefix_path = "/hello", tag = "MyTags::CommonOperations")]

@VersBinarii
Copy link
Contributor Author

VersBinarii commented Dec 29, 2022

Unfortunately not. This prefix comes from config file and additionally we have abstraction over the handlers so the prefix is dynamic.

I could have a go at implementing it if you would be ok with it

@sunli829
Copy link
Collaborator

Welcome to PR😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants