0

I'm using NSwag.OpenaPiDocument.FromJsonAsync() to load a JSON file. The JSON file is seperated in several files. Unfortunately, I'm getting this error:

Could not resolve the JSON path 'parameters.json#/tagsParam' with the full JSON path 'C:\Users\ribuss\Desktop\Swagger\json\petstore-separate\spec\parameters.json#/tagsParam'

I'm trying to import the following files (by calling the method for swagger.json)

In my application I use the following command:

NSwag.OpenApiDocument.FromJsonAsync(content, "C:/Users/ribuss/Desktop/Swagger/json/petstore-separate/spec/swagger.json").Result; // content is the full json text of swagger.json

Edit:

This is the schema which doesn't work:

{
  "tagsParam": {
    "name": "tags",
    "in": "query",
    "description": "tags to filter by",
    "required": false,
    "type": "array",
    "collectionFormat": "csv",
    "items": {
      "type": "string"
    }
  },
  "limitsParam": {
    "name": "limit",
    "in": "query",
    "description": "maximum number of results to return",
    "required": false,
    "type": "integer",
    "format": "int32"
  }
}

I've changed the schema by using definitions and it's working now.

Rudi
  • 926
  • 2
  • 19
  • 38
  • 1
    The referenced files must have the openapi json structure i think – Rico Suter Sep 22 '19 at 23:10
  • @RicoSuter I've added the schema. I don't know if the schema of the parameters.json file is invalid or not.. Anyway, it works by using definitions and then referencing to the definitions: parameters.json#/definitions/tagsParam – Rudi Sep 23 '19 at 08:25

0 Answers0