Created by: richardwhiuk
PR checklist
-
Read the contribution guidelines. -
Ran the shell script under ./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first. -
Filed the PR against the correct branch: master
,4.1.x
,5.0.x
. Default:master
. -
Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
@bjgill @farcaller @frol
Description of the PR
Currently the Rust Server generator uses an array to store the paths available on an API.
If the API has more than 32 configured paths, then the produced API fails to compile with:
error[E0277]: `&[&str; 37]` is not an iterator
--> src/server/mod.rs:113:60
|
113 | pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(&[
| ^^^^^^^^^^^^^^^^^^^^ `&[&str; 37]` is not an iterator
|
= help: the trait `std::iter::Iterator` is not implemented for `&[&str; 37]`
= note: required because of the requirements on the impl of `std::iter::IntoIterator` for `&[&str; 37]`
= note: required by `server::paths::regex::RegexSet::new`
This is because Iterator is only implemented for arrays up to 32 in size.
This change avoids that limitation by moving to using a Vec, and adds a test API to the Rust Server tests which has 33 paths, to avoid hitting this limit again.