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

Code examples please #72

Open
robert-dzikowski opened this issue May 25, 2023 · 1 comment
Open

Code examples please #72

robert-dzikowski opened this issue May 25, 2023 · 1 comment

Comments

@robert-dzikowski
Copy link

Hi.
I like your crate.
Could you provide more code examples, please?
For example, how to print all paths and methods (GET, POST ...) extracted from JSON file, please?

@robert-dzikowski
Copy link
Author

Currently to find which methods are implemented for an endpoint I use this code

for (path, path_item) in openapi.paths.iter() {
        println!("{}", path);
        if path_item.clone().into_item().unwrap().get.is_some() {
            println!("GET method exists");
        }
        if path_item.clone().into_item().unwrap().put.is_some() {
            println!("PUT method exists");
        }
    }

But I don't know if that is the best solution.

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

No branches or pull requests

1 participant