-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
I'm trying to generate the JavaPlayFramework with a very simple multiple files yaml spec but it doesn't work. I also tried with other server and I receive the same error. I was advised to try to validate the spec using the brand new "validate" function but I still receive the same error.
What is strange is that I am able to look at this spec using swagger-editor in local. There is not error at all. Just put both file in the swagger-editor folder and see for yourself.
There are 2 files (find the content of them below):
- swagger.yaml
- definitions.yaml
Here is the error I get every time
[main] INFO io.swagger.parser.Swagger20Parser - reading from swagger-editor/swagger.yaml
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -7
at java.lang.String.substring(Unknown Source)
at io.swagger.models.refs.GenericRef.computeSimpleRef(GenericRef.java:86)
at io.swagger.models.refs.GenericRef.<init>(GenericRef.java:29)
at io.swagger.models.properties.RefProperty.set$ref(RefProperty.java:56)
at io.swagger.models.properties.RefProperty.<init>(RefProperty.java:18)
at io.swagger.util.PropertyDeserializer.propertyFromNode(PropertyDeserializer.java:214)
at io.swagger.util.PropertyDeserializer.propertyFromNode(PropertyDeserializer.java:286)
at io.swagger.util.PropertyDeserializer.deserialize(PropertyDeserializer.java:137)
at io.swagger.util.PropertyDeserializer.deserialize(PropertyDeserializer.java:39)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3584)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3508)
at io.swagger.parser.util.SwaggerDeserializer.property(SwaggerDeserializer.java:974)
at io.swagger.parser.util.SwaggerDeserializer.definition(SwaggerDeserializer.java:789)
at io.swagger.parser.ResolverCache.loadRef(ResolverCache.java:135)
at io.swagger.parser.processors.ExternalRefProcessor.processRefToExternalDefinition(ExternalRefProcessor.java:34)
at io.swagger.parser.processors.ExternalRefProcessor.processRefProperty(ExternalRefProcessor.java:119)
at io.swagger.parser.processors.ExternalRefProcessor.processRefToExternalDefinition(ExternalRefProcessor.java:83)
at io.swagger.parser.processors.PropertyProcessor.processRefProperty(PropertyProcessor.java:34)
at io.swagger.parser.processors.PropertyProcessor.processProperty(PropertyProcessor.java:21)
at io.swagger.parser.processors.ResponseProcessor.processResponse(ResponseProcessor.java:21)
at io.swagger.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:45)
at io.swagger.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:101)
at io.swagger.parser.SwaggerResolver.resolve(SwaggerResolver.java:50)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:67)
at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:420)
at io.swagger.codegen.cmd.Generate.run(Generate.java:232)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:43)
Swagger-codegen version
Latest master
Swagger declaration file content or url
swagger.yaml
swagger: '2.0'
info:
version: "0.1.0"
title: Title
description: ""
contact:
name: me
email: hello@foo.com
url: http://www.foo.com
schemes:
- http
- https
basePath: /api
host: "localhost:9000"
consumes:
- application/json
produces:
- application/json
paths:
/actors:
delete:
tags:
- Actor
summary: Kill an actor in the actor system (MAW)
description: ""
operationId: killActor
parameters:
- in: body
name: body
required: true
schema:
$ref: "./definitions.yaml#/ActorInfo"
responses:
200:
description: OK
schema:
$ref: "./definitions.yaml#/DefaultMetaOnlyResponse"
get:
tags:
- Actor
summary: Request the status of an actor
description: ""
operationId: requestPrintStatus
parameters:
- in: body
name: body
required: true
schema:
$ref: "./definitions.yaml#/ActorInfo"
responses:
200:
description: OK
schema:
$ref: "./definitions.yaml#/DefaultMetaOnlyResponse"definitions.yaml
EmptyObject:
type: object
description: "Sample Description"
Error:
type: object
description: "Sample Description"
required:
- type
properties:
type:
type: string
description: "Sample Description"
default: "GenericException"
example: "GenericException"
itemInfo:
type: object
description: "Sample Description"
items:
$ref: '#/ItemId'
details:
type: string
description: "Sample Description"
example: "Could not update that field"
exception:
type: string
description: "Sample Description"
example: "DBException + stack trace"
ItemId:
type: object
description: "Sample Description"
required:
- id
- type
properties:
id:
type: string
description: "Sample Description"
example: "45"
type:
type: string
description: "playlist"
example: "5667"
ResponseMeta:
type: object
description: "Sample Description"
required:
- code
properties:
code:
type: string
description: "Sample Description"
default: Ok
enum:
- Ok
example: Ok
detail:
type: string
description: "Sample Description"
example: "this is some detail about the error or the success"
exception:
type: string
description: "Sample Description"
example: "IOException + stack trace"
errors:
type: array
description: "Sample Description"
items:
$ref: '#/Error'
ActorInfo:
type: object
description: "Sample Description"
required:
- actorPath
properties:
actorPath:
type: string
example: "/user/synchronizer"
DefaultMetaOnlyResponse:
type: object
required:
- meta
properties:
meta:
$ref: '#/ResponseMeta'Command line used for generation
java -jar swagger-codegen.jar generate -i swagger-editor/swagger.yaml -l java-play-framework -o generatedServer -DhideGenerationTimestamp=true
Steps to reproduce
Just run the command line above