Reputation: 308
I'm facing a little problem using Swagger UI and I'm not sure yet wheter is it a bug or not...
I've described my API using Swagger Editor and I have a method that contains an enum parameter.
Now, the problem: in the Swagger-UI documentation generated, in the 'model' tab, I have an empty definition of the 'messageType' object :( I want to display the allowed values (BRAND, VISITOR, COMMENT and RESPONSE)
A code snippet to reproduce:
swagger: '2.0'
info:
version: 1.0.0-SNAPSHOT
title: foo
description: foo
host: dev.fr
basePath: /base
schemes:
- http
- https
consumes:
- application/json
produces:
- application/json
paths:
/social/message:
post:
operationId: create
responses:
'201':
schema:
$ref: '#/definitions/message'
'default':
description: Default error response
definitions:
message:
required:
- title
- messageType
properties:
title:
type: string
messageType:
$ref: '#/definitions/messageType'
messageType:
enum:
- COMMENT
- RESPONSE
Any idea ? I am doing it wrong ? Is it a bug ? Many thanks :)
Upvotes: 0
Views: 3445
Reputation: 308
fehguy is right, problem solved by adding "type: string" on my object :)
Upvotes: 1