Giter VIP home page Giter VIP logo

Comments (4)

baywet avatar baywet commented on June 2, 2024 1

Unfortunately the parsing library we use under the covers is not really good at resolving the external references for the time being.
This is being worked on as it's a critical part of supporting OpenAPI 3.1 properly, and kiota will adopt this update when it's released.
We're tracking that through #3914 and I'm going to close this issue as a duplicate.

Your best workaround for the time being is to use hidi to inline all external references, and then feed the result to kiota.
https://github.com/microsoft/OpenAPI.NET/tree/vnext/src/Microsoft.OpenApi.Hidi

from kiota.

baywet avatar baywet commented on June 2, 2024

Hi @Sidonivs
Thanks for using kiota and for reaching out.
Do you mean that your OAS description uses external references?

from kiota.

Sidonivs avatar Sidonivs commented on June 2, 2024

Hi @Sidonivs Thanks for using kiota and for reaching out. Do you mean that your OAS description uses external references?

Yes. My main OAS file that I am supplying to Kiota looks something like this (the original has many more paths):

{
  "openapi": "3.0.3",
  "info": {
    "description": "text",
    "version": "2.0",
    "title": "title"
  },
  "servers": [
     {
        "url": "https://someurl.com/rest/v%7Bversion:apiVersion%7D"
     }
  ],
  "tags": [
     {
        "name": "dpp",
        "description": "text"
     }
  ],
  "paths": {
     "/dpp": {
        "put": {
           "tags": [
              "dpp"
           ],
           "summary": "putDPP",
           "operationId": "putDPP",
           "parameters": [
              {
                 "in": "query",
                 "name": "source",
                 "description": "text",
                 "required": true,
                  "schema": {
                     "$ref": "../model_v2/OtherSource.json"
                  }
               }
            ],
            "responses": {
               "200": {
                  "description": "OK"
               }
            }
         }
      }
   }
}

And then OtherSource.json is this:

{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "type": "string",
  "enum": [
     "VALUE1",
     "VALUE2",
     "VALUE3",
     "VALUE4",
     "VALUE5",
     "VALUE6"
  ]
}

I also tried generating only this simple example (these 2 exact files) and I get the same error OpenAPI specification version '' is not supported. Another thing I tried is removing "$schema": "http://json-schema.org/draft-06/schema#" from the second file, but still getting the same error.

This is the command I use to run Kiota (version 1.13.0):

kiota generate -d openapi.json -l CSharp -o DataImport.RestClient/Generated -c DppClient -n My.Namespace.DataImport.RestClient.Generated --co --cc

from kiota.

Sidonivs avatar Sidonivs commented on June 2, 2024

The OpenAPI Generator for csharp (which I don't like as much as Kiota) doesn't have an issue with generating a client for the above example.

from kiota.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.