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

feat(openapi): added example value support for param/schema #717

Merged
merged 2 commits into from
Jan 21, 2024

Conversation

chirag-droid
Copy link
Contributor

@chirag-droid chirag-droid commented Jan 2, 2024

Example Code

image

struct Api;

fn hello_world() -> String { String::from("Hello World") }

#[OpenApi]
impl Api {
    #[oai(path = "/", method = "get")]
    async fn get(
        &self,
        #[oai(example = "hello_world")] name: Query<String>,
    ) -> PlainText(String) {
        PlainText(name.0)
    }
}

@chirag-droid
Copy link
Contributor Author

I have also added test for it in poem-openapi/tests/operation_param.rs

@attila-lin
Copy link
Collaborator

fmt failed~

@chirag-droid
Copy link
Contributor Author

chirag-droid commented Jan 12, 2024

let me fix it. there should be a git pre commit hook for this. that just checks the format.

@sunli829 sunli829 merged commit 934e27c into poem-web:master Jan 21, 2024
7 checks passed
@sunli829
Copy link
Collaborator

thanks! 🙂

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

Successfully merging this pull request may close these issues.

3 participants