Generating a server code Unrecognized token 'openapi': was expecting ('true', 'false' or 'null')
When i try generate a server code with an YAML in OpenAPI version I got the message below and i am using the command too below:
Command:
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i "C:\Users\migno\Google Drive\Trabalho\RumoALL\Translogic\documentacao_arquitetura\Sinistros.yaml" -l spring -DapiPackage=com.rumolog.translogic.sinistros.api -DmodelPackage=com.rumolog.translogic.sinistros.model -o gerado/server/translogic/sinistros
Message:
[main] INFO io.swagger.parser.Swagger20Parser - reading from C:/Users/migno/Google Drive/Trabalho/RumoALL/Translogic/documentacao_arquitetura/Sinistros.yaml
[main] INFO io.swagger.parser.Swagger20Parser - reading from C:/Users/migno/Google Drive/Trabalho/RumoALL/Translogic/documentacao_arquitetura/Sinistros.yaml
[main] ERROR io.swagger.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting ('true', 'false' or 'null')
at [Source: (String)"openapi: 3.0.0
info:
title: Translogic Sinistros
description: Tem como objetivo visualizar os sinistros ocorridos, aceitar, recusar, alterar e criar.
version: 0.0.1
contact:
name: Bruno Mignoni
email: bmignoni@grupomult.com.br
externalDocs:
description: Tem como objetivo visualizar os sinistros ocorridos, aceitar, recusar, alterar e criar.
url: https://rumolog.atlassian.net/wiki/spaces/PT/pages/628097328/UC08+-+SRO+Sinistros
tags:
- name: sinistros
description: Informa"[truncated 4022 chars]; line: 1, column: 8]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:703)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2853)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1899)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:757)
at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4042)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2551)
at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:210)
at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:123)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:79)
at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:431)
at io.swagger.codegen.cmd.Generate.run(Generate.java:283)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
[main] WARN io.swagger.codegen.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.swagger-codegen-ignore) will be evaluated.
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:739)
at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
I clone the branch below and executed the maven command "mvn" in base directory.
After that, I executed the same command to generate and "swagger-codegen" worked fine