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

[BUG] - OpenAPI JSON File contains wrong typing #402

Open
IQisMySenpai opened this issue Jul 1, 2024 · 1 comment
Open

[BUG] - OpenAPI JSON File contains wrong typing #402

IQisMySenpai opened this issue Jul 1, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation engine:ALL Related to all engines or basic mechanisms enhancement New feature or request

Comments

@IQisMySenpai
Copy link

Describe the bug
The OpenAPI JSON File shows String as type Object. This leads to erroneous code generation when using Pydantic.

Version

{
  "version": "2024.6.8",
  "engine": ["WEBJS", "NOWEB", "VENOM"],
  "tier": "PLUS",
  "browser": "/usr/bin/google-chrome-stable"
}

To Reproduce Steps to reproduce the behavior:

  1. Download the OpenAPI JSON File
  2. Notice #/components/schemas/SessionStartRequest/properties/name/type (Example location, Multiple mistakes in OpenAPI JSON) is Object
  3. Notice how in TS it is specified as a string.
  4. Generate Pydantic Models with datamodel-codegen --input openapi.json --input-file-type openapi --output waha-model.py.
  5. The Typing will be wrong, as there is an inconsistency between the OpenAPI Typing and the TS Typing.

Expected behavior
I would expect the type to be String

@IQisMySenpai IQisMySenpai added the bug Something isn't working label Jul 1, 2024
@IQisMySenpai
Copy link
Author

I did some more digging:

The origin of the problem seems to be that WhatsappSession is used directly in the TS definition in the router in multiple places. Normally this triggers the SessionPipe to translate the String into a WhatsappSession. But as noted below the definition of the SessionPipe we need to use the decorator SessionApiParam for the parameters to correctly display in the OpenAPI Documentation.

@devlikepro devlikepro added documentation Improvements or additions to documentation enhancement New feature or request engine:ALL Related to all engines or basic mechanisms and removed bug Something isn't working labels Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation engine:ALL Related to all engines or basic mechanisms enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants