-
-
Notifications
You must be signed in to change notification settings - Fork 227
Allow id
and type
as model attributes
#378
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
Comments
There was another fix recently to disable all built ins to prevent some weirdness. I believe it was #359 where properties caused problems if they were named the same as a builtin type (e.g. Unfortunately we use property names as variables in other places as well (e.g. when constructing or serializing a class). Allowing the use of Python builtins could cause problems in the future if we ever try to use that builtin as part of the generated client. I'm pretty confident that we'll never use If we do allow those builtins as property names, we'll need to be aware that they can never be used in templates and document that somewhere visible. |
@dbanty Agreed, but I'm wondering if we could use the converted identifier whenever it's a variable (during serialization/deserialization)? |
It would complicate the design quite a bit. We'd have to have 3 different names for the properties instead of the 2 we currently have. I suppose we could do this as a template pipe where we have I think we can just exclude |
…2(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),701(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae) are allowed as parameter names and will not be modified anymore (closes #378)
… not be renamed (closes #378)(#407). Thanks @forest-benchling!
Describe the bug
If a schema is defined with
id
as a property, it is translated toid_
in the generated code.I believe this was done to fix a security vulnerability, but if we allow
id
only as model attributes (and not as variables), that doesn't seem like it would be an issue.This is a big usability concern for us at Benchling because almost all of our models have an
id
, and it increases the onboarding cost for new users of our SDK to have to learn to useid_
.To Reproduce
Example spec snippet:
Expected behavior
Properties that are keywords/reserved words should not be altered, if possible.
OpenAPI Spec File
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: