swagger_parser icon indicating copy to clipboard operation
swagger_parser copied to clipboard

References to other files are not properly mapped

Open theimmigrant-canada opened this issue 1 year ago • 0 comments

Hi,

I have this environment with multiple json files that have parts of models (for example, various enumerations in one file, and the usage of those enumeration in another file). Those interfile references are not being mapped for json decoding.

Example enumeration file (service_enumerations.json):

{
    "openapi": "3.0.1",
    "info": {
      "title": "Service Enumerations",
      "version": "1.0"
    },
    "components": {
        "schemas": {          
          "LogLevel": {
            "type": "string",
            "enum": [
              "Trace",
              "Debug",
              "Information",
              "Warning",
              "Error",
              "Critical",
              "None"
            ]
          },
        }
      }
}

Example usage (service.json):

{
    "openapi": "3.0.1",
    "info": {
      "title": "Service",
      "version": "1.0"
    },
    "components": {
        "schemas": {          
          "CreateSessionParameters": {
            "required": [
              "sessionType"
            ],
            "type": "object",
            "properties": {
              "sessionType": {
                "$ref": "service_enumerations.json#/components/schemas/SessionTypes"
              }
            }
          }
        }
      }
}

I would expect the json encoding and decoding to be in the session_types.dart file but they are not there. Also the CreateSessionParameters doesn't seem to be able to create the fromJson for the SessionTypes

theimmigrant-canada avatar Oct 23 '23 19:10 theimmigrant-canada