Skip to content

Is there a known workaround for handling an array of string/enum? #87

Closed
@lzhoucs

Description

@lzhoucs

I have an array of simple enum called weathers. Although I can get to the array itself:

fieldWithPath("weathers").type(JsonFieldType.ARRAY).description("an array of weathers")

I can't get to the element inside it currently due to the exact same limitation as: spring-projects/spring-restdocs#505. As such, I got the following openapi3 spec:

weathers:
          type: array
          description: an array of weathers
          items:
            oneOf:
            - type: object
            - type: boolean
            - type: string
            - type: number

It seems the relevant logic is added in this PR: #62 as "default behavior".

Here is a minified demo: https://github.com/lzhoucs/spring-restdocs/tree/87-demo/samples/junit5

What I would like to see is as follows:

weathers:
          type: array
          description: an array of weathers
          items:
            type: string
            enum: [SPRING, SUMMER...]

Is there any workaround to get close to what I expected above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions