Я пытаюсь сгенерировать заглушку node.js-сервера с помощью codegen.Я скачал файл swagger-codegen-cli-2.3.1.jar
и пытаюсь сгенерировать код с помощью команды cli.Однако, это терпит неудачу со следующим сообщением об ошибке:
[main] ERROR io.swagger.codegen.DefaultCodegen - unexpected missing property for name response
[main] WARN io.swagger.codegen.DefaultCodegen - skipping invalid array property {
"baseName" : "response",
"getter" : "getResponse",
....
"isReadOnly" : false,
"vendorExtensions" : { },
"hasValidation" : false,
"isXmlAttribute" : false,
"isXmlWrapped" : false
}
[main] ERROR io.swagger.codegen.DefaultCodegen - unexpected missing property for name response
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
Tag: Tag {
name: messages
description: Messages for blue instance
externalDocs: null
extensions:{}}
Operation: listMessages
Resource: get /instances/{instanceId}/messages
Definitions: {message-common=io.swagger.models.ModelImpl@e68ed4e0, Error Response=io.swagger.models.ModelImpl@7bcf5e6c}
Exception: null
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:932)
at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:808)
at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:431)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:746)
at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.NullPointerException
... 5 more
Вот выдержка из моего файла определений чванства.Я добавил / удалил атрибут x-swagger-router-controller
, но это тоже не помогло.
swagger: '2.0'
info:
title: Messages API
version: '1.0'
description: |-
Call used to get messages
host: 'localhost:8080'
paths:
'/instances/{instanceId}/messages':
get:
summary: Get all messages
operationId: listMessages
responses:
'200':
description: 'Success Response'
schema:
type: array
items:
title: Message Output
description: The properties that are included
allOf:
- type: object
properties:
id:
type: string
- title: Message Common
description: The properties that are shared
type: object
properties:
message:
type: string
description: Operation the system must do
details:
type: string
description: 'Textual data'
required:
- message
- details
'401':
description: Unauthorized requests
schema:
type: object
title: Error Response
description: Standard error message.
properties:
errors:
type: array
items:
type: object
properties:
code:
type: string
description: Human readable category
message:
type: string
description: Detailed error message
required:
- code
- message
required:
- errors
'500':
description: Response for other issues
schema:
type: object
title: Error Response
description: Standard error message.
properties:
errors:
type: array
items:
type: object
properties:
code:
type: string
description: Human readable category
message:
type: string
description: Detailed error message
required:
- code
- message
required:
- errors
description: 'Call used to get messages, notices, and/or instructions from E&E system for the product to take. '
parameters:
- name: Digest
in: header
type: string
description: The digest for the body being passed
tags:
- messages
parameters:
- name: instanceId
in: path
type: string
required: true
description: The specific instance for which the message is relevant
basePath: /v1
schemes:
- http
consumes:
- application/json
produces:
- application/json
tags:
- name: messages
description: Messages for instance
Пожалуйста, помогите.Не уверен, что мне здесь не хватает.