swagger-api / swagger-parser

Swagger Spec to Java POJOs
http://swagger.io
Apache License 2.0
785 stars 531 forks source link

The incoming YAML document exceeds the limit #1857

Closed skwashp closed 1 year ago

skwashp commented 1 year ago

As requested by @wing328 on OpenAPITools/openapi-generator/#14096, I am creating this ticket as it appears to be the right place to get it fixed.

Description

The generator fails wen using large spec files. Error: com.fasterxml.jackson.dataformat.yaml.JacksonYAMLParseException: The incoming YAML document exceeds the limit: 3145728 code points.

Trace

[main] WARN  i.s.v.p.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.v3.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content  (maxDepth 2000, maxYamlAliasesForCollections 2147483647)
    at io.swagger.v3.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:438)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:477)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:406)
    at io.swagger.v3.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:211)
    at io.swagger.v3.parser.util.DeserializationUtils.deserializeIntoTree(DeserializationUtils.java:143)
    at io.swagger.v3.parser.OpenAPIV3Parser.readContents(OpenAPIV3Parser.java:165)
    at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:94)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:342)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:263)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseIndentlessSequenceEntryKey.produce(ParserImpl.java:611)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:185)
    at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:57)
    at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:43)
    at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:136)
    at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:116)
    at org.yaml.snakeyaml.composer.Composer.composeScalarNode(Composer.java:239)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:208)
    at org.yaml.snakeyaml.composer.Composer.composeSequenceNode(Composer.java:270)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:210)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:134)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:160)
    at io.swagger.v3.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:415)
    ... 12 common frames omitted
[main] ERROR i.s.v.p.util.DeserializationUtils - Error parsing content
com.fasterxml.jackson.dataformat.yaml.JacksonYAMLParseException: The incoming YAML document exceeds the limit: 3145728 code points.
 at [Source: (StringReader); line: 68310, column: 14]
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:409)
    at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:506)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:84)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:20)
    at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
    at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4716)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3076)
    at io.swagger.v3.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:232)
    at io.swagger.v3.parser.util.DeserializationUtils.deserializeIntoTree(DeserializationUtils.java:143)
    at io.swagger.v3.parser.OpenAPIV3Parser.readContents(OpenAPIV3Parser.java:165)
    at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:94)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:342)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:263)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseIndentlessSequenceEntryKey.produce(ParserImpl.java:611)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:185)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:195)
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:403)
    ... 16 common frames omitted
[main] ERROR i.s.v.p.util.DeserializationUtils - Error parsing content
com.fasterxml.jackson.dataformat.yaml.JacksonYAMLParseException: The incoming YAML document exceeds the limit: 3145728 code points.
 at [Source: (StringReader); line: 68310, column: 14]
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:409)
    at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:506)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:84)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:20)
    at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
    at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4716)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3076)
    at io.swagger.v3.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:232)
    at io.swagger.v3.parser.util.DeserializationUtils.deserializeIntoTree(DeserializationUtils.java:143)
    at io.swagger.v3.parser.OpenAPIV3Parser.readContents(OpenAPIV3Parser.java:165)
    at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:94)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:342)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:263)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseIndentlessSequenceEntryKey.produce(ParserImpl.java:611)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:185)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:195)
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:403)
    ... 16 common frames omitted
[main] WARN  io.swagger.v3.parser.OpenAPIV3Parser - Exception while parsing:
com.fasterxml.jackson.dataformat.yaml.JacksonYAMLParseException: The incoming YAML document exceeds the limit: 3145728 code points.
 at [Source: (StringReader); line: 68310, column: 14]
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:409)
    at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:506)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:84)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:20)
    at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
    at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4716)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3076)
    at io.swagger.v3.parser.OpenAPIV3Parser.readContents(OpenAPIV3Parser.java:167)
    at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:94)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:342)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:263)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseIndentlessSequenceEntryKey.produce(ParserImpl.java:611)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:185)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:195)
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:403)
    ... 14 common frames omitted
[main] WARN  i.s.parser.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content  (maxDepth 2000, maxYamlAliasesForCollections 2147483647)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:402)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:477)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:406)
    at io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:220)
    at io.swagger.parser.Swagger20Parser.deserializeYaml(Swagger20Parser.java:85)
    at io.swagger.parser.Swagger20Parser.readWithInfo(Swagger20Parser.java:64)
    at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:35)
    at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:83)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:342)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:263)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseIndentlessSequenceEntryKey.produce(ParserImpl.java:611)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:185)
    at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:57)
    at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:43)
    at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:136)
    at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:116)
    at org.yaml.snakeyaml.composer.Composer.composeScalarNode(Composer.java:239)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:208)
    at org.yaml.snakeyaml.composer.Composer.composeSequenceNode(Composer.java:270)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:210)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:134)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:160)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:381)
    ... 13 common frames omitted
[main] WARN  i.s.parser.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content  (maxDepth 2000, maxYamlAliasesForCollections 2147483647)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:402)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:477)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:406)
    at io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:220)
    at io.swagger.parser.Swagger20Parser.deserializeYaml(Swagger20Parser.java:85)
    at io.swagger.parser.Swagger20Parser.readWithInfo(Swagger20Parser.java:64)
    at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:45)
    at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:83)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:342)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:263)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseIndentlessSequenceEntryKey.produce(ParserImpl.java:611)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:185)
    at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:57)
    at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:43)
    at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:136)
    at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:116)
    at org.yaml.snakeyaml.composer.Composer.composeScalarNode(Composer.java:239)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:208)
    at org.yaml.snakeyaml.composer.Composer.composeSequenceNode(Composer.java:270)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:210)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:357)
    at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:336)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:311)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:212)
    at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:134)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:160)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:381)
    ... 13 common frames omitted
[main] ERROR i.s.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value
 at [Source: (StringReader); line: 1, column: 3]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:735)
    at com.fasterxml.jackson.core.base.ParserMinimalBase.reportUnexpectedNumberChar(ParserMinimalBase.java:557)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleInvalidNumberStart(ReaderBasedJsonParser.java:1718)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseNegNumber(ReaderBasedJsonParser.java:1467)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:784)
    at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4703)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3076)
    at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:209)
    at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:122)
    at io.swagger.parser.SwaggerCompatConverter.readWithInfo(SwaggerCompatConverter.java:93)
    at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:45)
    at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:83)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR i.s.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value
 at [Source: (StringReader); line: 1, column: 3]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:735)
    at com.fasterxml.jackson.core.base.ParserMinimalBase.reportUnexpectedNumberChar(ParserMinimalBase.java:557)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleInvalidNumberStart(ReaderBasedJsonParser.java:1718)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseNegNumber(ReaderBasedJsonParser.java:1467)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:784)
    at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4703)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3076)
    at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:209)
    at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:122)
    at io.swagger.parser.SwaggerCompatConverter.readWithInfo(SwaggerCompatConverter.java:93)
    at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:45)
    at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:83)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:573)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:631)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.OpenAPI.getExtensions()" because "openAPI" is null
    at org.openapitools.codegen.DefaultCodegen.setOpenAPI(DefaultCodegen.java:832)
    at org.openapitools.codegen.ClientOptInput.setOpenAPI(ClientOptInput.java:111)
    at org.openapitools.codegen.ClientOptInput.openAPI(ClientOptInput.java:35)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:685)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:457)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

openapi-generator version

6.2.1

OpenAPI declaration file content or url

https://raw.githubusercontent.com/github/rest-api-description/main/descriptions-next/api.github.com/dereferenced/api.github.com.deref.yaml

Generation Details

openapi-generator generate -i ~/Downloads/api.github.com.deref.yaml -g go -o /tmp/github-go/

Steps to reproduce

  1. Run the command above
  2. Swear

Related issues/PRs

Suggest a fix

Implement a larger default or a configuration option so larger spec files can be used. @wing328 suggested an environment variable.

garydgregory commented 1 year ago

Yeah, the current limit fails parsing one of the Slack Swagger files

santhosh-uc commented 1 year ago

I'm facing the same issue

wtrocki commented 1 year ago

Problem can be patched by setting limits in following class https://github.com/swagger-api/swagger-parser/blob/06c86496875196667ed07abd1e8b42c53f06d4c3/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/DeserializationUtils.java#L257-L263

Problem with adding this is that swagger parser is used in so many underlying projects that would need to expose this as some form of options or flags.

frantuma commented 1 year ago

fixed by #1872 1872