question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error parsing File

See original GitHub issue

autorest -Input C:\Repository\HA.Client\HA.Client\swagger.json AutoRest Code Generator © 2017 Microsoft Corporation. https://aka.ms/autorest ERROR: API Version must be in the format: yyyy-MM-dd, optionally followed by -pr eview, -alpha, -beta, -rc, -privatepreview. Path: file:///C:/Repository/HA.Client/HA.Client/swagger.json#/info/versi on FATAL: Error generating client model: System.ArgumentNullException: Value cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.IsMatch(String input) at AutoRest.Swagger.Validation.ListOperationNamingWarning.<GetValidationMessa ges>d__6.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__1592.MoveNext() at System.Linq.Enumerable.ConcatIterator1.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__1592.MoveNext() at System.Linq.Enumerable.ConcatIterator1.MoveNext() at AutoRest.Swagger.SwaggerModeler.Build(ServiceDefinition serviceDefinition)

at AutoRest.Core.AutoRestController.Generate() ERROR: Error generating client model: System.ArgumentNullException: Value cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.IsMatch(String input) at AutoRest.Swagger.Validation.ListOperationNamingWarning.<GetValidationMessa ges>d__6.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__1592.MoveNext() at System.Linq.Enumerable.ConcatIterator1.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__1592.MoveNext() at System.Linq.Enumerable.ConcatIterator1.MoveNext() at AutoRest.Swagger.SwaggerModeler.Build(ServiceDefinition serviceDefinition)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
amarzaverycommented, Mar 17, 2017

So, your swagger was missing operationId for every operation. As per the swagger specification, every operation must have a unique operationId.

Once I added that I was able to generate the client. I added the operationIds by giving them some logical name as follows. You can change them the way you like.

{
  "swagger": "2.0",
  "info": {
    "version": "2017-03-16T02:40:38Z",
    "title": "API"
  },
  "host": "test.amazonaws.com",
  "basePath": "/1",
  "schemes": [
    "https"
  ],
  "paths": {
    "/checkin": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId":"FlightCheckins_Post",
        "parameters": [
          {
            "in": "body",
            "name": "FlightPassengerCheckinInfoList",
            "required": true,
            "schema": {
              "$ref": "#/definitions/FlightPassengerCheckinInfoList"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          },
          "400": {
            "description": "400 response"
          }
        }
      }
    },
    "/flightproducts": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId":"FlightProducts_Get",
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        }
      }
    },
    "/flightstatus": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId":"FlightStatus_Get",
        "parameters": [
          {
            "name": "AirlineCode",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "ArrivalAirportCode",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "DepartureAirportCode",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "DepartureDateTimeStart",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "FlightNumber",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "AvailableSeatType",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "DepartureDateTimeEnd",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/IHaResponseFlightStatus"
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        }
      }
    },
    "/purchase": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId":"FlightPurchase_Post",
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        }
      }
    },
    "/tripinformation": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId":"TripInformation_Get",
        "parameters": [
          {
            "name": "LastName",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "Barcode",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "HawaiianMilesNumber",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "FirstName",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "FlightNumber",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "DestinationAirportCode",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "ETicket",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "Passport",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "PNR",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/FlightPassengerDetails"
            }
          },
          "400": {
            "description": "400 response"
          },
          "403": {
            "description": "403 response"
          }
        }
      },
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId": "TripInformation_Update",
        "parameters": [
          {
            "in": "body",
            "name": "UpdateTripInfoRequest",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateTripInfoRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200 response"
          },
          "400": {
            "description": "400 response"
          }
        }
      }
    }
  },
  "definitions": {
    "FlightPassengerDetails": {
      "type": "object",
      "required": [
        "DestinationAirportCode",
        "FirstName",
        "FlightNumber",
        "LastName",
        "OriginAirportCode",
        "Pnr"
      ],
      "properties": {
        "Pnr": {
          "type": "string"
        },
        "Barcode": {
          "type": "string"
        },
        "ETicket": {
          "type": "string"
        },
        "HawaiianMilesNumber": {
          "type": "string"
        },
        "FirstName": {
          "type": "string"
        },
        "LastName": {
          "type": "string"
        },
        "OriginAirportCode": {
          "type": "string"
        },
        "DestinationAirportCode": {
          "type": "string"
        },
        "FlightNumber": {
          "type": "string"
        },
        "ReservationDetails": {
          "$ref": "#/definitions/ReservationDetails"
        },
        "PassengerDetails": {
          "$ref": "#/definitions/PassengerDetails"
        },
        "SeatDetails": {
          "$ref": "#/definitions/SeatDetails"
        },
        "FlightStatus": {
          "$ref": "#/definitions/FlightStatus"
        },
        "PurchasedProducts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/FlightProduct"
          }
        }
      }
    },
    "FlightPassengerSettings": {
      "type": "object",
      "required": [
        "DestinationAirportCode",
        "FirstName",
        "FlightNumber",
        "LastName",
        "OriginAirportCode",
        "Pnr"
      ],
      "properties": {
        "Pnr": {
          "type": "string"
        },
        "Barcode": {
          "type": "string"
        },
        "ETicket": {
          "type": "string"
        },
        "HawaiianMilesNumber": {
          "type": "string"
        },
        "FirstName": {
          "type": "string"
        },
        "LastName": {
          "type": "string"
        },
        "OriginAirportCode": {
          "type": "string"
        },
        "DestinationAirportCode": {
          "type": "string"
        },
        "FlightNumber": {
          "type": "string"
        },
        "ReservationSettings": {
          "$ref": "#/definitions/ReservationSettings"
        },
        "PassengerSettings": {
          "$ref": "#/definitions/PassengerSettings"
        },
        "SeatSettings": {
          "$ref": "#/definitions/SeatSettings"
        }
      }
    },
    "FlightProduct": {
      "type": "object",
      "properties": {
        "Category": {
          "type": "string",
          "enum": [
            "bags",
            "seats"
          ]
        },
        "ProductType": {
          "type": "string",
          "enum": [
            "bicycle",
            "scuba",
            "windsurf",
            "normal",
            "surf",
            "overweight",
            "carseat",
            "fruit",
            "wheelchair"
          ]
        },
        "Fee": {
          "type": "integer",
          "format": "decimal"
        }
      }
    },
    "IHaResponseFlightStatus": {
      "type": "object",
      "properties": {
        "Results": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/FlightStatus"
          }
        },
        "Status": {
          "type": "string"
        },
        "Count": {
          "type": "integer"
        }
      }
    },
    "FlightPassengerCheckinInfo": {
      "type": "object",
      "required": [
        "DestinationAirportCode",
        "FirstName",
        "FlightNumber",
        "LastName",
        "OriginAirportCode",
        "Pnr"
      ],
      "properties": {
        "Pnr": {
          "type": "string"
        },
        "Barcode": {
          "type": "string"
        },
        "ETicket": {
          "type": "string"
        },
        "HawaiianMilesNumber": {
          "type": "string"
        },
        "FirstName": {
          "type": "string"
        },
        "LastName": {
          "type": "string"
        },
        "OriginAirportCode": {
          "type": "string"
        },
        "DestinationAirportCode": {
          "type": "string"
        },
        "FlightNumber": {
          "type": "string"
        },
        "ReservationSettings": {
          "$ref": "#/definitions/ReservationSettings"
        },
        "PassengerSettings": {
          "$ref": "#/definitions/PassengerSettings"
        },
        "SeatSettings": {
          "$ref": "#/definitions/SeatSettings"
        },
        "ResponseOptions": {
          "$ref": "#/definitions/ResponseOptions"
        },
        "Passport": {
          "$ref": "#/definitions/Passport"
        }
      }
    },
    "SeatSettings": {
      "type": "object",
      "properties": {
        "Number": {
          "type": "string"
        },
        "Preference": {
          "type": "string"
        },
        "VoluntaryDowngrade": {
          "type": "boolean"
        },
        "PriorityInfo": {
          "type": "string"
        }
      }
    },
    "UpdateTripInfoRequest": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/FlightPassengerSettings"
      }
    },
    "Empty": {
      "type": "object",
      "title": "Empty Schema"
    },
    "Passport": {
      "type": "object",
      "properties": {
        "CountryOfIssue": {
          "type": "string"
        },
        "CountryOfCitizenship": {
          "type": "string"
        },
        "DateOfIssue": {
          "type": "string",
          "format": "date-time"
        },
        "DateOfBirth": {
          "type": "string",
          "format": "date-time"
        },
        "Firstname": {
          "type": "string"
        },
        "Lastname": {
          "type": "string"
        },
        "Middlename": {
          "type": "string"
        },
        "PassportNumber": {
          "type": "string"
        },
        "Gender": {
          "type": "string"
        }
      }
    },
    "FlightStatus": {
      "type": "object",
      "required": [
        "AirlineCode"
      ],
      "properties": {
        "FlightNumber": {
          "type": "string"
        },
        "AirlineCode": {
          "type": "string"
        },
        "AircraftType": {
          "type": "string"
        },
        "FlightDelayDuration": {
          "type": "string"
        },
        "FlightArrivalDelayDuration": {
          "type": "string"
        },
        "DepartureAirportCode": {
          "type": "string"
        },
        "ArrivalAirportCode": {
          "type": "string"
        },
        "IsCheckinWindowClosed": {
          "type": "boolean"
        },
        "GateNumber": {
          "type": "string"
        },
        "Terminal": {
          "type": "string"
        },
        "IsOnTime": {
          "type": "boolean"
        },
        "ScheduledDepartureTime": {
          "type": "string",
          "format": "date-time"
        },
        "ScheduledArrivalTime": {
          "type": "string",
          "format": "date-time"
        },
        "IsCodeshare": {
          "type": "boolean"
        }
      }
    },
    "ReservationSettings": {
      "type": "object",
      "properties": {
        "IsGroup": {
          "type": "boolean"
        },
        "IsMinorTravelingAlone": {
          "type": "boolean"
        },
        "WithInfant": {
          "type": "boolean"
        }
      }
    },
    "ResponseOptions": {
      "type": "object",
      "properties": {
        "IncludeBoardingPass": {
          "type": "boolean"
        },
        "IncludeAvailableProducts": {
          "type": "boolean"
        }
      }
    },
    "FlightPassengerCheckinInfoList": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/FlightPassengerCheckinInfo"
      }
    },
    "ReservationDetails": {
      "type": "object",
      "properties": {
        "IsGroup": {
          "type": "boolean"
        },
        "IsMinorTravelingAlone": {
          "type": "boolean"
        },
        "WithInfant": {
          "type": "boolean"
        },
        "HasPassportInfo": {
          "type": "boolean"
        },
        "IsMilitary": {
          "type": "boolean"
        },
        "IsMultiSegment": {
          "type": "boolean"
        },
        "IsCheckedIn": {
          "type": "boolean"
        },
        "AllowAddInfant": {
          "type": "boolean"
        },
        "AllowAddMinor": {
          "type": "boolean"
        }
      }
    },
    "PassengerSettings": {
      "type": "object",
      "properties": {
        "MiddleName": {
          "type": "string"
        },
        "DateOfBirth": {
          "type": "string",
          "format": "datetime"
        },
        "RedressNumber": {
          "type": "string"
        },
        "KnownTravelerNumber": {
          "type": "string"
        },
        "HawaiianMilesNumber": {
          "type": "string"
        }
      }
    },
    "SeatDetails": {
      "type": "object",
      "properties": {
        "Status": {
          "type": "string",
          "enum": [
            "EC",
            "PS"
          ]
        },
        "Number": {
          "type": "string"
        },
        "Preference": {
          "type": "string"
        },
        "VoluntaryDowngrade": {
          "type": "boolean"
        },
        "PriorityInfo": {
          "type": "string"
        }
      }
    },
    "PassengerDetails": {
      "type": "object",
      "properties": {
        "FirstName": {
          "type": "string"
        },
        "LastName": {
          "type": "string"
        },
        "MiddleName": {
          "type": "string"
        },
        "DateOfBirth": {
          "type": "string"
        },
        "RedressNumber": {
          "type": "string"
        },
        "KnownTravelerNumber": {
          "type": "string"
        },
        "HawaiianMilesNumber": {
          "type": "string"
        }
      }
    }
  }
}

Please find attached the node.js and the CSharp clients.

0reactions
johnamcruzcommented, Mar 17, 2017

Thanks @amarzavery. It works great now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Parsing File JSP or JAVA in Netbeans 7.3.1
i fixed "Error Parsing File" in my Java file (IDE: Netbeans) by just deleting the space before the bottom most "}" and press...
Read more >
Error parsing file (red mark) when having 2 or more java ...
Error parsing file (red mark) when having 2 or more java classes in the same java file, inside the same package, that share...
Read more >
NetBeans: error parsing file - Java Solutions
The java file in NetBeans IDE is marked by an error marker that is caused by error parsing the file. This is often...
Read more >
How to resolve Rational DOORS "Error while parsing file ... - IBM
Answer · Note the file name and location named in the DOORS error that indicates data corruption · Stop the DOORS server ·...
Read more >
Projects Window Error parsing File red exclamation mark
In the project explorer there is a red exclamation mark See file attached. But when I view the file in the editor there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found