swagger-api / swagger-api/swagger-parser
Poor error message on incorrectly written inheritance: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'swagger': was expecting ('true', 'false' or 'null')
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
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}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided YAML declaration and the swagger-codegen CLI command, focusing on the malformed allOf entry where $ref and type lack list-item hyphens. Done means the parser reports the invalid allOf contents with the expected and received values and a line number, instead of the misleading JsonParseException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100