Skip to content

No way to specify a SchemaType.ARRAY items example schema #445

Open
@tiagomistral

Description

@tiagomistral

..unless Im missing something.

I want to configure the example that will be present in an array.
As in the case below I want the example to be 'MONDAY':

components:
  schemas:
    Pojo:
      properties:
        weekDays:
          type: array
          description: |-
            Restriction week days.
            Values - [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY]
          items:
            type: string
            example: "MONDAY"

To achieve this I try:

@JsonbProperty("weekDays")
@Schema(name="weekDays", type = SchemaType.ARRAY, implementation = String.class,  example = "MONDAY",
            description="Restriction week days.\nValues - [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY]")
private Set<DayOfWeek> weekDays = Collections.emptySet();

But the example is not at the item level as I need it, but at the weekDays property level.

How can I generate an items example?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions