Comments (6)
Hey @pax95 ,
Spring restdocs tries to infer the type from the example bodies, but you can override this with:
fieldWithPath("featurings").type(JsonFieldType.ARRAY).description("List of featuring artist if any")
You need to use JsonFieldType types and not the Java types. I hope, this helps!
from restdocs-api-spec.
Sounds reasonable. I think this could be done by extending the PathDescriptor from spring-restdocs.
Would you be in to give it a try.
from restdocs-api-spec.
@mduesterhoeft yeah, I'd be happy to give it a shot. If there are any pointers that you can share to help me get started, that'd be great!
from restdocs-api-spec.
Looks like we already have that:
You can specify the type of a parameter using the type()
method.
.pathParameters(
parameterWithName("someId").description("some id"),
parameterWithName("otherId").description("otherId id").type(SimpleType.INTEGER)
)
from restdocs-api-spec.
Is there a similar way to specify a ARRAY type. Setting the type to java.util.List generates ->
{
"attributes" : { },
"description" : "List of featuring artist if any",
"ignored" : false,
"path" : "[].musicInfo.featurings[]",
"type" : "java.util.List",
"optional" : true
}
in resource.json where it should have been ARRAY
Update:
Found the answer in another issue. Just use JsonFieldType.ARRAY for array type it seems.
from restdocs-api-spec.
This should be working by now, see
#181 (comment) and the linked example:
https://github.com/ePages-de/restdocs-api-spec/pull/185/files#diff-672ed55d0ceac62de36f9aa7020d71ca27d6bbb03b9c0d7777699d21287191b5R298-R321
from restdocs-api-spec.
Related Issues (20)
- Share common attributes of extensions in the same class
- Please tell me how to make the api specification look better in swagger ui
- When i use webtestclient, i am getting on error message 'please use RestDocumentationRequestBuilders with urlTemplate to construct the request' HOT 1
- Replace TravisCI with GitHub Actions HOT 2
- OpenAPI 3 oauth2 security scheme not applied globally for all endpoints
- How to join documentation from multi-project build? HOT 1
- Limited supported constraints(PATTERN) in generated contract HOT 3
- Response Json Data 4Depth
- Keep supporting Spring Boot 2.7.x HOT 5
- Subschema examples
- openapi3 task null exception HOT 1
- Support License section of OpenAPI spec
- There is no way to indicate the requestBody is required
- Use general description, summary and operationId in generate openapi2 and postman
- Doesn't it support setting up authentication for cookies?
- Documenting Bean Validation constraints not supporting spring boot 3 HOT 1
- Could not find com.epages:restdocs-api-spec-openapi-generator:0.19.1 HOT 1
- Add support for communicating BigDecimal scale/precision using multipleOf
- Can you show an example of configuring `Contact`, `Server` in build.gradle.kts file?
- Could not find com.epages:restdocs-api-spec-openapi-generator:0.19.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restdocs-api-spec.