ShipEngine / shipengine-openapi

The official OpenAPI 3.0 definitions for ShipEngine™
https://shipengine.github.io/shipengine-openapi/
22 stars 16 forks source link

Error trying to generate API Client with swagger.json #14

Closed artsai closed 2 years ago

artsai commented 2 years ago

HI, I'm using NSwagStudio v 13.15.10.0 I downloaded swagger.json from https://shipengine.github.io/shipengine-openapi/ There were errors in the file, Line 9333 and Line 12027

Could you please try to check by test generating a client with what you guy provided? Thank you Art

semarj commented 2 years ago

Hello @artsai. Can you post what lines those are for you? When I download the swagger from there I get 9333 is:

            "allOf": [
--->          {
                "$ref": "#/components/schemas/weight"
              }

And 12027 is:

            {
--->           "$ref": "#/components/schemas/rate%20estimate"
            }
          ]

Are those the same for you?

artsai commented 2 years ago

@semarj It's 9933

       "properties": {
          "package_id": {
            "readOnly": true,
            "type": "integer",
            "format": "int32"
          },
--->          "description": "The package ID\n",
          "package_code": {
            "allOf": [
              {
                "$ref": "#/components/schemas/package_code"
              }
            ],

I use NSwagStudio to generate the API, its complaints about that line. I moved "description" to the properties section, that will work. In the yaml file, it's line 7925-7926.

image

As for "rate%20estimate" in your YAML, it's image so I just use space instead of "%20"

Since I would like to rely on the provided OpenAPI docs, I would like to know if you guys test creating API client from the docs?

semarj commented 2 years ago

Currently this doesn't happen. We'll take a look.

semarj commented 2 years ago

It looks like we do not test the client generation but you might consider using https://github.com/ShipEngine/shipengine-dotnet instead of generating the client. We will look at the SDK generation test on the next iteration of OpenApi specification generation.

artsai commented 2 years ago

I used https://github.com/ShipEngine/shipengine-dotnet as a guideline to build our own Partner API SDK as the Partner Open API specification wasn't provided, that is understandable. As for the Account operations APIs, the provided SDK doesn't have all of the endpoints implemented, so I was relying on the API documents for the generated client so that my team can quickly start configuring and testing ShipEngine Acccount API operations. At the moment, I do have the Account API generated after my manual fixes. The generated methods work for what I need at the moment. I may switch to extending missing implementations with the shipengine-dotnet if the generated client becomes unreliable.