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

python gen: 'value' property skipped, and $refs from .net generics in swagger #6227

Open
thelazydogsback opened this issue Mar 4, 2025 · 1 comment
Labels
Python status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:bug A broken experience type:question An issue that's a question

Comments

@thelazydogsback
Copy link

thelazydogsback commented Mar 4, 2025

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Windows executable

Client library/SDK language

Python

Describe the bug

There are two issues:

                "schema": {
                  "$ref": "#/components/schemas/XXX.WWW.ZZZDto`1[[XXX.Dto.YYYDto, XXX, Version=2.4.229.0, Culture=neutral, PublicKeyToken=null]]"
                }

The swagger generated using .Net tools has the $ref as specified above.
I see the following error during generation:

fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: #/components - The key 'XXX.WWW.ZZZDto`1[[XXX.Dto.YYYDto, XXX, Version=2.4.229.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'.

However, I'm not sure what I'm supposed to do about this, as this is how the swagger is generated.
The code seems to work FWICT, but the class is named ZeroCultureNeutralPublicKeyTokenNull.

The other issue is this one:

"XXX.YYY.FilterSpecificationDto": {
        "required": [
          "field",
          "operator"
        ],
        "type": "object",
        "properties": {
          "field": {
            "minLength": 1,
            "type": "string"
          },
          "operator": {
            "minLength": 1,
            "type": "string"
          },
          "value": {
            "nullable": true
          }
        },
        "additionalProperties": false
      },

The class is generated, but it completely skips over 'value', just generating the other two properties:

@dataclass
class FilterSpecificationDto(Parsable):
    # The field property
    field: Optional[str] = None
    # The operator property
    operator: Optional[str] = None

thanks

Expected behavior

Expect $ref to work, even if some openapi rule needs to be relaxed, as it's part of the .net ecosystem.
Expect all fields in the filter DTO to be generated.

How to reproduce

Used latest kiota x64 binaries

Open API description file

Can not provide

Kiota Version

1.23.0

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

  • Use ZeroCultureNeutralPublicKeyTokenNull as classname, or rename after generation (or alias on all imports)
  • hand-edit DTO class (3 lines) after generation to add support for missing value property

Configuration

Win x64 Python

Debug output

Click to expand log ```
</details>


### Other information

_No response_
@thelazydogsback thelazydogsback added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Mar 4, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Mar 4, 2025
@msgraph-bot msgraph-bot bot added the Python label Mar 4, 2025
@baywet
Copy link
Member

baywet commented Mar 5, 2025

Hi @thelazydogsback
Thank you for using kiota and for reaching out.

How do you get a description with such a reference in the first place? Is it swagger (not to confuse with swagger UI which is the web app part) or the aspnet.openapi package?

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:question An issue that's a question and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Mar 5, 2025
@baywet baywet moved this from Needs Triage 🔍 to Waits for author 🔁 in Kiota Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Python status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:bug A broken experience type:question An issue that's a question
Projects
Status: Waits for author 🔁
Development

No branches or pull requests

2 participants