Skip to content

Empty tag causes error generating client #2283

Closed

Description

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

Csharp

Describe the bug

I'm trying to generate a client for the TrackUnit group API, but it throws an error: "error generating the client: Value cannot be null or empty: referenceId (Parameter 'referenceId')"
After some trial/error I found the cause to be the presence of "tags": [ "" ]
If I remove those it seems to work.

Expected behavior

Ignore empty tags instead of generating an error.

How to reproduce

You can run the following:
kiota generate -l CSharp -c BaseTrackUnitGroupsClient -n CCTrackUnitClient -d https://developers.trackunit.com/openapi/62bc9436ca283d0083119e2b -o . --ebc

Open API description file

https://developers.trackunit.com/openapi/62bc9436ca283d0083119e2b

Kiota Version

1.24.1+68eefbe046b9a9e4ee8b2029070a1cf097e5a984

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

No response

Known Workarounds

Download the openapi and remove the "tags": [ "" ] lines.

Configuration

  • OS: Windows 11, using Visual Studio 2022.
  • I do not think it is relevant to this configuration

Debug output

Click to expand log Debug: KiotaBuilder kiota version 1.24.1 Debug: KiotaBuilder cache file C:\Users\stefan\AppData\Local\Temp\kiota\cache\generation\D5041F0FF32584C3284CEC6532AD86B93F3A8B85095C3677915F36655E2FB22C\62bc9436ca283d0083119e2b is up to date and clearCache is False, using it Information: KiotaBuilder loaded description from remote source Debug: KiotaBuilder step 1 - reading the stream - took 00:00:00.0113209 Critical: KiotaBuilder error generating the client: Value cannot be null or empty: referenceId (Parameter 'referenceId')

Other information

No response

Activity

  1. moved this to Needs Triage 🔍 in Kiotaon Mar 23, 2025
  2. baywet commented on Mar 24, 2025

    @baywet
    Member

    Hi Stefan Cuypers (@StefanCuypers)
    Thank you for using kiota and for reaching out.

    I have transferred your issue to OpenAPI.net, the library kiota uses to parse OpenAPI documents. We're currently incubating the preview of v2 in kiota, and feedback like this is extremely helpful in stabilizing the new version of the library.

    For maintainers/contributors, we should probably filter out empty values as we parse the document.

    Is this something you'd like to submit a pull request for provided some guidance?

  3. added
    priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
    and removed on Mar 24, 2025
  4. StefanCuypers commented on Mar 24, 2025

    @StefanCuypers
    ContributorAuthor

    Hi Vincent Biret (@baywet)
    Thank you for the reply. I haven't really done any pull request on Github before and I have limited time. But if I can help and it does not take too much of my time, I sure want to look at it (provided some guidance:-)).

  5. baywet commented on Mar 24, 2025

    @baywet
    Member

    The code responsible for the deserialization of the tags is located in Deserializers like here.

    o.Tags = new HashSet<OpenApiTagReference>(tags, OpenApiTagComparer.Instance);

    (there's one per version of OpenAPI, 2.0, 3.0 and 3.1)

    And you can add additional unit tests here

    Let us know if you have any additional comments or questions.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    WIPpriority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:bugA broken experience

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions