-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Generated PHP classes sometimes contain invalid chars #1145
Comments
@jamiehannaford is Seems like the parameter is related to creating new "cat". I simply name it as just "cat" |
@jamiehannaford also do you mind sharing with us how your swagger spec is generated? Is that using some third-party swagger plug-ins? |
@wing328 But there are different permutations of the model, depending on the operation. For example, when creating a cat the user would not send an All that's happening above is that I'm referencing an externally defined model schema. I'm not using a third-party plugin. |
@jamiehannaford Thanks for sharing with me how the swagger spec was created and it's definitely valid to use relative schema file in swagger spec. But I couldn't repeat the issue with the following:
manually created a file named "new-Pet.json" and ran Do you mind sharing with me what the content of |
Sure, it's here. Please note I renamed it from |
Thanks. But still no luck in reproducing the issue. I'll given it another try this weekend. |
Hey @jamiehannaford, I can reproduce it with this model (in "cat-new": {
"$ref": "cat-new.json"
} which would generate the model file: lib/Model/Cat-new.php If so, changing the key (model name) to "CatNew": {
"$ref": "cat-new.json"
} |
@xhh Yep, that's it. I didn't see any documentation which indicated that camel case was the only acceptable format. IMO, the code generator needs to always convert class names so they end up being idiomatic in the outputted language, regardless of input. |
Fix #1145: sanitize model name in PHP client
Thanks @xhh! 😄 |
If I reference the following in my Swagger schema:
Then it will generate a model file called
Cat-new.php
, with aCat-new
class inside, which is prohibited. Ideally we should be generatingCatNew
rather thanCat_New
.The text was updated successfully, but these errors were encountered: