Created
May 12, 2022 14:17
-
-
Save jonthegeek/fa5efa04d598ae2a9fe04a7178133658 to your computer and use it in GitHub Desktop.
The start of an openAPI Parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api_spec <- jsonlite::read_json("R-raw/swagger.json") | |
# I never got to the point of actually using this here, but this is where it is. | |
base_path <- api_spec$servers[[1]]$url | |
methods <- tibble::enframe( | |
x = api_spec$paths, | |
name = "path" | |
) %>% | |
tidyr::unnest_wider(value) %>% | |
tidyr::pivot_longer( | |
get:put, | |
names_to = "http" | |
) %>% | |
dplyr::mutate( | |
http = toupper(http), | |
is_null = purrr::map_lgl(value, is.null) | |
) %>% | |
dplyr::filter(!is_null) %>% | |
dplyr::select(-is_null) %>% | |
tidyr::unnest_wider( | |
value | |
) %>% | |
dplyr::filter(is.na(deprecated) | !deprecated) %>% | |
dplyr::select(-deprecated) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment