OpenApi implementation for .net
# support
g
hi, i'm using ServerUrl setup to build with VAPI i'm actually manually reading the json since i had problem with the OpenApi implementation did anyone tried with the scaffolded versione of .net? i get errors from reading the ufficial json # Steps to reproduce using Visual Studio Create a blazor, worker or web api project with .net 9 Create connected service OpenApi with url https://api.vapi.ai/api-json Build error Severity Code Description Project File Line Suppression State Error (active) MSB3073 The command ""C:\Users\leori\.nuget\packages\nswag.msbuild\13.18.2\build\../tools/Win/NSwag.exe" openapi2csclient /className:api_jsonClient /namespace:TestingOpenApiScaffold /input:"C:\Projects\CheckMate\TestingOpenApiScaffold\OpenAPIs\api-json.json" /output:"obj\api-jsonClient.cs" " exited with code -1. TestingOpenApiScaffold C:\Users\leori\.nuget\packages\nswag.apidescription.client\13.18.2\build\NSwag.ApiDescription.Client.targets 34 Reading online looks like there is some problem with Enums do you know any workaround or way to fix this? thank you very much
v
Hi there! 👋 I understand you're running into issues with the OpenAPI implementation for .NET when trying to use VAPI's API. I don't have specific information about anyone successfully using the scaffolded version of .NET with VAPI's OpenAPI implementation, but I can share some potential workarounds and troubleshooting steps that might help with your MSB3073 error. ## Potential Causes & Workarounds ### 1. Schema Validation Issues The error might be related to how enums are defined in the OpenAPI specification. According to [information from a Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341487904677167114), adding
additionalProperties: false
to the function schema might help resolve schema validation errors. For example:
Copy code
json
{
  name: "yourFunctionName",
  function: {
    parameters: {
      type: "object",
      properties: {
        // your existing properties here
      },
      required: ["your_required_fields"],
      additionalProperties: false  // Add this line
    }
  }
}
### 2. Alternative Integration Options Instead of using the scaffolded OpenAPI implementation, you might consider: - Using VAPI's C# SDK directly, which is available on [GitHub](https://github.com/VapiAI/server-sdk-csharp) - Manually creating the API client using HttpClient or RestSharp - As suggested in a [Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342588929622413312), implementing options as an array in your code instead of setting up an API might be simpler and faster ### 3. Debugging Steps - Examine the OpenAPI specification at
https://api.vapi.ai/api-json
to identify potential issues with enum definitions - Check for any schema validation errors or format incompatibilities - Ensure you're using the latest version of NSwag and related packages ### 4.
strict
Parameter Handling
Issues with the
strict
parameter in VAPI's tool calling schema might be related to incorrect schema validation. According to [Discord information](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1326276427628154920), if the
strict
parameter is not being passed down correctly, it can lead to validation errors. Do any of these approaches seem like they might work for your situation? I'd be happy to discuss more specific aspects of these potential solutions! Sources: - [Discord thread about schema validation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341487904677167114) - [VAPI C# SDK](https://github.com/VapiAI/server-sdk-csharp) - [Discord thread about alternative implementation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342588929622413312) - [Discord thread about strict parameter handling](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1326276427628154920)
v
Message marked as helpful by @Genex! 🎉
g
the Vapi nuget seems hard to implement. there is no real example
v
checking if this is resolved/solved for you?
g
No. I'm still doing manual json parsing since the sdk it's kinda undocumented without examples
v
Hey Genex, you have to raise the request for it over the github issues after that SDK moderator will get back to you.