Skip to content

Cleanup for OpenAPI Generation#14

Merged
mekhlakapoor merged 4 commits into
mainfrom
fix-openapi-configs
Jul 18, 2025
Merged

Cleanup for OpenAPI Generation#14
mekhlakapoor merged 4 commits into
mainfrom
fix-openapi-configs

Conversation

@mekhlakapoor

@mekhlakapoor mekhlakapoor commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator

Ran into multiple errors when importing aind-sharepoint-service-async-client due to issues with auto-generated enums.

Errors include:
(1) _sharepoint_service_async_client\models\las_projectid.py", line 44 ENUM_102_MINUS_01_MINUS_044_MINUS_10_–_CTY_GENOMICS = '102-01-044-10 – CTY Genomics' ^ SyntaxError: invalid character '–' (U+2013)
cause: character '–' in enum value was being used to generate the enum key name in the async client model.
frequency: 5

(2) raise TypeError('Attempted to reuse key: %r' % key) TypeError: Attempted to reuse key: 'MMPATCHX'
cause: the LimsProject model has 2 values: "mMPATCHx" and "mMPatchx". The enum values (default is CAPS) were being used to generate the enum key names. frequency: 2

(3) ModuleNotFoundError: aind_sharepoint_service_async_client.models.lightcycle import Lightcycle
cause: name of module was light_cycle for nsb2019, lightcycle0 for nsb2023. this stems from duplicate naming of enum classes in the 2 nsb lists
frequency: 2

This PR:

  • Adds "NSB2019" and "NSB2023" prefixes to all enum class names for easier generation and documentation purposes
  • Updates the generate_openapi.py script to use the enum definitions rather than re-generating it with open api (using x-enum-varnames)

Notes:

  • Tested out the openapi python generator config options, but support for enum flexibility was a little more limited than other generators (ex: did not support enumNameMapping, etc)

@mekhlakapoor mekhlakapoor changed the title fix: unicode characters in enums Cleanup for OpenAPI Generation Jul 18, 2025
@mekhlakapoor mekhlakapoor requested a review from jtyoung84 July 18, 2025 07:35
@mekhlakapoor mekhlakapoor merged commit 8ff28e1 into main Jul 18, 2025
3 checks passed
@mekhlakapoor mekhlakapoor deleted the fix-openapi-configs branch July 18, 2025 17:22
@mekhlakapoor

Copy link
Copy Markdown
Collaborator Author

Merging for now. @jtyoung84 might look into a cleaner solution in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant