Ошибка при создании пакета DART для проекта флаттера - PullRequest
0 голосов
/ 19 марта 2020

РЕДАКТИРОВАНИЕ: Я отредактировал мой чванливый путь. Но теперь я получаю ошибку ниже.

[main] INFO io.swagger.parser.Swagger20Parser - reading from https://SWAGGERFILE/api
[main] INFO io.swagger.parser.Swagger20Parser - reading from https://SWAGGERFILE/api
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:764)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:299)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

Ниже приведена команда, которую я использую в ma c для генерации пакета дротиков

java -jar /Users/PATH/modules/swagger-codegen-cli/src/main/target/swagger-codegen-cli.jar generate -i https://SWAGGERFILE/api-docs/#/ -l dart -o /Users/PATH/STORE/DART/PACKAGE

Она отлично работает для

 java -jar /Users/PATH/modules/swagger-codegen-cli/src/main/target/swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l dart -o /Users/PATH/STORE/DART/PACKAGE

Ниже приведена ошибка, которую я получаю:

[main] INFO io.swagger.parser.Swagger20Parser - reading from https://SWAGGERFILE/api-docs/#/
[main] WARN io.swagger.parser.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content  (maxDepth 2000)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:300)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:525)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:438)
    at io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:137)
    at io.swagger.parser.Swagger20Parser.deserializeYaml(Swagger20Parser.java:83)
    at io.swagger.parser.Swagger20Parser.convertToSwagger(Swagger20Parser.java:125)
    at io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:109)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:69)
    at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:437)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:297)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: mapping values are not allowed here
 in 'string', line 14, column 17:
          box-sizing: border-box;
                    ^

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:869)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:358)
    at org.yaml.snakeyaml.scanner.ScannerImpl.peekToken(ScannerImpl.java:250)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentEnd.produce(ParserImpl.java:253)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
    at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:87)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:279)
    ... 10 more
[main] INFO io.swagger.parser.Swagger20Parser - reading from https://production.user-api.api.findnemo.in/api-docs/#/
[main] WARN io.swagger.parser.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content  (maxDepth 2000)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:300)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:525)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:438)
    at io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:137)
    at io.swagger.parser.Swagger20Parser.deserializeYaml(Swagger20Parser.java:83)
    at io.swagger.parser.Swagger20Parser.convertToSwagger(Swagger20Parser.java:125)
    at io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:109)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:83)
    at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:437)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:297)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: mapping values are not allowed here
 in 'string', line 14, column 17:
          box-sizing: border-box;
                    ^

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:869)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:358)
    at org.yaml.snakeyaml.scanner.ScannerImpl.peekToken(ScannerImpl.java:250)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentEnd.produce(ParserImpl.java:253)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
    at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:87)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:279)
    ... 10 more
[main] ERROR io.swagger.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)"
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Swagger UI</title>
  <link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
  <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" /><link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />

  <style>
    html
    {
      box-sizing: border-box;
      overflow: -moz-scrollbars-vertical;
      overflow-y: scroll;
    }"[truncated 2632 chars]; line: 2, column: 2]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1840)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:712)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:637)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1917)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:773)
    at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4231)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2711)
    at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:194)
    at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:123)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:83)
    at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:437)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:297)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:764)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:299)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
shwetadodiya@shwetas-MBP swagger-codegen-master % java -jar /Users/shwetadodiya/Documents/FlutterProjects/Swagger/swagger-codegen-master/modules/swagger-codegen-cli/src/main/target/swagger-codegen-cli.jar generate -i https://production.user-api.api.findnemo.in/api-docs/#/ -l dart -o /Users/shwetadodiya/Documents/FlutterProjects/Swagger/SwaggerCode 
[main] INFO io.swagger.parser.Swagger20Parser - reading from https://production.user-api.api.findnemo.in/api-docs/#/
[main] WARN io.swagger.parser.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content  (maxDepth 2000)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:300)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:525)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:438)
    at io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:137)
    at io.swagger.parser.Swagger20Parser.deserializeYaml(Swagger20Parser.java:83)
    at io.swagger.parser.Swagger20Parser.convertToSwagger(Swagger20Parser.java:125)
    at io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:109)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:69)
    at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:437)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:297)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: mapping values are not allowed here
 in 'string', line 14, column 17:
          box-sizing: border-box;
                    ^

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:869)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:358)
    at org.yaml.snakeyaml.scanner.ScannerImpl.peekToken(ScannerImpl.java:250)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentEnd.produce(ParserImpl.java:253)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
    at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:87)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:279)
    ... 10 more
[main] INFO io.swagger.parser.Swagger20Parser - reading from https://production.user-api.api.findnemo.in/api-docs/#/
[main] WARN io.swagger.parser.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content  (maxDepth 2000)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:300)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:525)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:438)
    at io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:137)
    at io.swagger.parser.Swagger20Parser.deserializeYaml(Swagger20Parser.java:83)
    at io.swagger.parser.Swagger20Parser.convertToSwagger(Swagger20Parser.java:125)
    at io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:109)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:83)
    at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:437)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:297)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: mapping values are not allowed here
 in 'string', line 14, column 17:
          box-sizing: border-box;
                    ^

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:869)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:358)
    at org.yaml.snakeyaml.scanner.ScannerImpl.peekToken(ScannerImpl.java:250)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentEnd.produce(ParserImpl.java:253)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
    at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:87)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
    at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:279)
    ... 10 more
[main] ERROR io.swagger.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)"
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Swagger UI</title>
  <link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
  <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" /><link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />

  <style>
    html
    {
      box-sizing: border-box;
      overflow: -moz-scrollbars-vertical;
      overflow-y: scroll;
    }"[truncated 2632 chars]; line: 2, column: 2]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1840)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:712)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:637)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1917)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:773)
    at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4231)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2711)
    at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:194)
    at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:123)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:83)
    at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:437)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:297)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:764)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:299)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

1 Ответ

1 голос
/ 19 марта 2020

Параметр -i ожидает путь к файлу OpenAPI YAML / JSON. Похоже, https://SWAGGERFILE/api-docs/#/ указывает на страницу HTML (например, Swagger UI), а не на фактический файл OpenAPI YAML / JSON.

Если вы используете Swagger UI, вот как вы можете получить YAML / JSON ссылка на файл:
Как экспортировать файл Swagger JSON / YAML из интерфейса Swagger?

...