example is placed always as plain string into ApiModelPropertyI'm always frustrated when I should always write own enum class from examples instead of use generated.
/util/testExecutionStatus:
get:
description: Get Execution Statuses, Priorities, Components, Labels
summary: Get Execution Statuses, Priorities, Components, Labels
tags:
- UtilResource
operationId: UtilTestExecutionStatusGet
deprecated: false
produces:
- application/json
parameters:
- name: Content-Type
in: header
required: true
type: string
description: ''
responses:
200:
description: ''
schema:
type: array
items:
$ref: '#/definitions/GetExecutionStatusesAndPrioritiesAndComponentsAndLabelsResponse'
examples:
application/json:
- id: -1
name: UNEXECUTED
description: The test has not yet been executed.
color: '#A0A0A0'
type: 0
- id: 1
name: PASS
description: Test was executed and passed successfully.
color: '#75B000'
type: 0
- id: 2
name: FAIL
description: Test was executed and failed.
color: '#CC3300'
type: 0
- id: 3
name: WIP
description: Test execution is a work-in-progress.
color: '#F2B000'
type: 0
- id: 4
name: BLOCKED
description: The test execution of this test was blocked for some reason.
color: '#6693B0'
type: 0
- id: 5
name: PENDING
description: ''
color: '#990099'
type: 1
- id: 6
name: APPROVED
description: ''
color: '#996633'
type: 1
- id: 7
name: 12
description: ''
color: '#ff3366'
type: 1
headers: {}
Is there possible to add feature to add code generation instead placing plain string into @ApiModelProperty(example = "" ?
Is there another (online) tools to generate code from OpenAPI's example ?
@ApiModelProperty is from the swagger-annotations project.
I am not sure to understand what you expect…
The examples array is not the appropriate place to define enums in your OpenAPI document. You could keep the example code, but you'd still need the enum definition at the model/schema level in order for these to be generated.
@jimschubert Thanks for response. Issue can be closed
Most helpful comment
The examples array is not the appropriate place to define enums in your OpenAPI document. You could keep the example code, but you'd still need the enum definition at the model/schema level in order for these to be generated.