Skip to content

Empty tag causes error generating client #2283

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
StefanCuypers opened this issue Mar 23, 2025 · 3 comments · Fixed by #2286
Closed

Empty tag causes error generating client #2283

StefanCuypers opened this issue Mar 23, 2025 · 3 comments · Fixed by #2286
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days type:bug A broken experience WIP
Milestone

Comments

@StefanCuypers
Copy link
Contributor

StefanCuypers commented Mar 23, 2025

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

@StefanCuypers StefanCuypers added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Mar 23, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Mar 23, 2025
@baywet baywet transferred this issue from microsoft/kiota Mar 24, 2025
@baywet
Copy link
Member

baywet commented Mar 24, 2025

Hi @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?

@baywet baywet added priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Mar 24, 2025
@baywet baywet removed this from Kiota Mar 24, 2025
@baywet baywet added this to the v2-Preview17 milestone Mar 24, 2025
@StefanCuypers
Copy link
Contributor Author

Hi @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:-)).

@baywet
Copy link
Member

baywet commented Mar 24, 2025

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.

StefanCuypers added a commit to StefanCuypers/OpenAPI.NET that referenced this issue Mar 26, 2025
StefanCuypers added a commit to StefanCuypers/OpenAPI.NET that referenced this issue Mar 27, 2025
StefanCuypers added a commit to StefanCuypers/OpenAPI.NET that referenced this issue Mar 27, 2025
baywet pushed a commit that referenced this issue Mar 28, 2025
* Fix issue Empty tag causes error generating Kiota client #2283

* fix: empty tag causes Exception generating Kiota client #2283

* fix: empty tag causes Exception generating Kiota client #2283
@baywet baywet modified the milestones: v2-Preview18, v2-Preview17 Apr 14, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days type:bug A broken experience WIP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants