gpt4 book ai didi

flutter - 为Flutter项目创建DART包时出错

转载 作者:行者123 更新时间:2023-12-03 04:54:55 25 4
gpt4 key购买 nike

编辑:
我编辑了摇摇欲坠的路径。但是我现在低于错误。

[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)

以下是我在Mac中用于生成dart包的命令
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)

最佳答案

-i参数需要OpenAPI YAML / JSON文件的路径。看来https://SWAGGERFILE/api-docs/#/指向HTML页面(例如Swagger UI),而不是实际的OpenAPI YAML / JSON文件。

如果使用Swagger UI,请按照以下方法获取YAML / JSON文件链接:
How to export a Swagger JSON/YAML file from Swagger UI?

关于flutter - 为Flutter项目创建DART包时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60750816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com