Skip to content
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

TypeBuilder _repr_ should be implemented in python for better debugging #1253

Closed
aaronvg opened this issue Dec 17, 2024 · 0 comments · Fixed by #1260
Closed

TypeBuilder _repr_ should be implemented in python for better debugging #1253

aaronvg opened this issue Dec 17, 2024 · 0 comments · Fixed by #1260
Labels
good first issue Good for newcomers

Comments

@aaronvg
Copy link
Contributor

aaronvg commented Dec 17, 2024

When users print out the Typebuilder instance in python, they see a rust pointer instead of the actual type information.

@aaronvg aaronvg added the good first issue Good for newcomers label Dec 17, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 14, 2025
…entation (#1260)

This PR enhances the TypeBuilder's string representation to show all
properties of a class and values of an enum, including their aliases and
descriptions.

Changes:
- Show all properties in class representation:
  ```python
  # Before:
  TypeBuilder(Classes: ['User'])
  
  # After:
TypeBuilder(Classes: ['User { name (alias='username', desc='The user\'s
full name'), age (desc='User\'s age in years'), email }'])
  ```

- Show all values in enum representation:
  ```python
  # Before:
  TypeBuilder(Enums: ['Status'])
  
  # After:
TypeBuilder(Enums: ['Status { ACTIVE (alias='active', desc='User is
active'), INACTIVE (alias='inactive'), PENDING }'])
  ```

- Store and track metadata:
  - Cache aliases and descriptions in builders
  - Sort properties and values for consistent output
  - Properly escape quotes in string values


Fixes #1253

---------

Co-authored-by: hellovai <[email protected]>
Co-authored-by: Aaron Villalpando <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
1 participant