Skip to content

Allow id and type as model attributes #378

Closed
@forest-benchling

Description

@forest-benchling

Describe the bug
If a schema is defined with id as a property, it is translated to id_ 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 use id_.

To Reproduce
Example spec snippet:

	DnaSequence:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string

Expected behavior
Properties that are keywords/reserved words should not be altered, if possible.

OpenAPI Spec File

Desktop (please complete the following information):

  • OS: [e.g. macOS 10.15.1]
  • Python Version: [e.g. 3.8.0]
  • openapi-python-client version [e.g. 0.1.0]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions