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
Consolidate swagger type information #388
Conversation
Old: switch(type,
"bool" = ,
"logical" = "boolean",
"double" = ,
"numeric" = "number",
"int" = "integer",
"character" = "string"
) New: addSwaggerInfo(
"boolean",
c("bool", "boolean", "logical"),
"[01tfTF]|true|false|TRUE|FALSE",
as.logical
)
addSwaggerInfo(
"number",
c("dbl", "double", "float", "number", "numeric"),
"-?\\\\d*\\\\.?\\\\d+",
as.numeric
)
addSwaggerInfo(
"integer",
c("int", "integer"),
"-?\\\\d+",
as.integer
)
addSwaggerInfo(
"string",
c("chr", "str", "character", "string"),
"[^/]+",
as.character
) |
I am worried about this change. https://github.com/trestletech/plumber/pull/388/files#diff-c6fcef256c9135dbef4ee90414a8074aR54 Should the regex be updated to only look for known types? Or should the regex look for a pattern of |
Codecov Report
@@ Coverage Diff @@
## master #388 +/- ##
=========================================
+ Coverage 89.26% 89.3% +0.03%
=========================================
Files 29 29
Lines 1435 1449 +14
=========================================
+ Hits 1281 1294 +13
- Misses 154 155 +1
Continue to review full report at Codecov.
|
* master: add serializer_rds and serializer_rds3 (#387) Support around non-ASCII key values in query string (#396) update host from 0.0.0.0 to 127.0.0.1 (and [::] to [::1]) for swagger url only (#376) Add support for returning promises from endpoints (#248) use httpuv url encode / decode (#355) Add support for serializer parameters in plumber block (#356)
This currently will cause an error if a type isn't found.
Before, I would at least be able to find the |
Fixes #351
This consolidates all swagger type information into one location. If a new type is supported in the future, only one spot will need to be added.