ePages-de / ePages-de/restdocs-api-spec

How to document an array of strings?

Open
#147 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
427
Forks
116
Avg merge
23h 54m
Merged PRs (30d)
1

Description

I already looked at #87 and at [spring-restdocs#505](https://github.com/spring-projects/spring-restdocs/issues/505). I am using `restDocsApiSpec: "0.10.0"`.

My API `api/admin/users` returns a JSON Array containing only strings: `["user1", "user2", "user3"]`.

What I currently get is:

~~~
api-admin-users1367467944:
type: array
items:
type: object
~~~

the corresponding Java Code:

~~~
responseFields(
fieldWithPath("[]").description("List of user Ids").optional()
).
~~~

What I want is:

~~~
api-admin-users1367467944:
type: array
items:
type: string
~~~

Is there already a workaround for documenting an array of strings in `ePages-de/restdoc-api-spec`? Would somebody be willing to share an example on how to do it?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.