Created by: AlexanderEggers
I have noticed that in certain cases, the enum usage for path parameter and url query parameter is incorrectly implemented.
In the case I have an enum with MY_ENUM("MyEnum") and I am using the enum as a path parameter. The path would look like that "myPath/.../MY_ENUM/...". This request would always fail. That is due to the different enum value than the server would expect.
To fix this issue, I suggest we add a custom toString to every enum class so that we will not use the enum var name but the value. That way the path would look like this "myPath/.../MyEnum/...".
Changes made with this PR:
- Added custom toString to the enum class script.
PR checklist
-
Read the contribution guidelines. -
If contributing template-only or documentation-only changes which will change sample output, build the project before. -
Run the shell script(s) under ./bin/
(or Windows batch scripts under.\bin\windows
) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the code or mustache templates for a language ({LANG}
) (e.g. php, ruby, python, etc). -
File the PR against the correct branch: master
,4.3.x
,5.0.x
. Default:master
. -
Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
@jimschubert (2017/09)