Coder Social home page Coder Social logo

Comments (6)

aress31 avatar aress31 commented on August 19, 2024

I am not totally convinced that the reported issue is due to the code that you pointed out. Indeed, before entering the loop where the removal of the final coma happens there is an implemented check to ensure that the we have got at least one valid parameter to process: if (params != null).

Furethemore, I am personally able to parse swagger files containing empty parameters with no problem.

Could you please provide more information? Ideally (if possible) send me the swagger file that you are trying to parse with the swagger-parser/swurg via email so I can have a deep look into the issue.

from openapi-parser.

adetlefsen-rms avatar adetlefsen-rms commented on August 19, 2024

Example swagger file that causes the error:

{
  "swagger": "2.0",
  "info": {},
  "host": "some.server.com:20666",
  "basePath": "/http://some.server.com:20666",
  "tags": [
    {
      "name": "analysis"
    },
    {
      "name": "generic"
    }
  ],
  "schemes": [
    "http"
  ],
  "paths": {
    "/": {
      "get": {
        "operationId": "get",
        "parameters": [],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "string"
            },
            "headers": {}
          }
        }
      }
    }
  }
}

from openapi-parser.

aress31 avatar aress31 commented on August 19, 2024

Thanks, I am going to have a look at this tomorrow. But at first sight, I would say that that removing that line:
"parameters": [], could solve the issue since I suspect the List<Parameter> params to contain an empty Parameter instead of null.
/Alex

from openapi-parser.

adetlefsen-rms avatar adetlefsen-rms commented on August 19, 2024

I can't guarantee what the target site has in its swagger definition! I'd rather the plugin handle that...

from openapi-parser.

aress31 avatar aress31 commented on August 19, 2024

The target website still has to have a valid swagger definition!

That's the prerequisite for the plugin to work, swurg does not have to validate the swagger definition; there is already plenty of websites available for that.
As I already said, I will have a look at the issue and IF it is an exception not-handled by swurg I will fix it, otherwise you will have to obtain a properly formatted swagger file!

Swurg is not a bug free plugin and all reported issues are appreciated when properly documented.

This is an on-going project (cf. readme.md) and finding issues is quite normal.

/Alex

from openapi-parser.

adetlefsen-rms avatar adetlefsen-rms commented on August 19, 2024

It is perfectly valid for parameters to be an empty array in the swagger definition.

Understood that this is an on-going project and that your valuable time goes into it. I appreciate it.

from openapi-parser.

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.