swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Poor error message on incorrectly written inheritance: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'swagger': was expecting ('true', 'false' or 'null')

Open jan-matejka opened this issue 7 years ago • 1 comments

Redirected here from https://github.com/swagger-api/swagger-codegen/issues/5080

Description

Poor error message on incorrectly written inheritance: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'swagger': was expecting ('true', 'false' or 'null')

Swagger-codegen version

current master; HEAD = 878b390ab6962cc7cf5a9f8f5dec836d109cd2c9

Swagger declaration file content or url
swagger: "2.0"

info:
  title: swagger-codegen broken error messages
  version: '1.0'

definitions:
  foo:
    type: object
    properties:
      x:
        type: string

  bar:
    allOf:
      $ref: "#/definitions/foo"
      type: object
      properties:
        y:
          type: string

paths: {}

Note the missing hyphens in front of $ref and type in the single occurence of allOf

Command line used for generation

JAR=".../swagger-codegen.git/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" java -jar "${JAR}" generate -i ~/sscce.yaml -l swagger

Related issues

Plenty, google Unrecognized token 'swagger': was expecting ('true', 'false' or 'null')

Suggest a Fix

invalid contents of allOf: on line {line} expected {expected} got {got} on line {line_no}

jan-matejka avatar Mar 15 '17 17:03 jan-matejka

same question, anyone can help me?

hellojukay avatar Oct 21 '21 15:10 hellojukay