284 questions
Score of 0
1 answer
140 views
Duplicate Content-Type header in Spring REST Docs using RestAssuredMockMvc
I'm currently writing tests using RestAssuredMockMvc together with Spring REST Docs.
Setup
In my global spec setup, I configure the headers like this:
package com.animore.config
import com.fasterxml....
Score of 0
0 answers
93 views
Modify request parameters with Spring Rest Docs 3.x?
Spring Rest Docs 3.x removed the preprocessor to modify request parameters. In the release notes, it is unclear how to do it now. I would love to see an example of how it can be done now. Anybody has ...
Score of 1
1 answer
134 views
How to use RestDocs with the new MockMvcTester API
Is there a way to produce RestDocs with the new (since Boot 3.4) MockMvcTester API? (Not using plain MockMvc?)
I did not find any API on the new fluent style MockMvcTester.
assertThat(
...
Score of 0
1 answer
195 views
Spring RESTDocs Error: Query parameters with the following names were not found in the request
I'm trying to document the API using Spring RESTDocs on Spring 3.3.2.
However, the following error appears.
Query parameters with the following names were not found in the request: [password, driverId,...
Score of 1
0 answers
150 views
Is there a way to document multipart form data with id ‘com.epages.restdocs-api-spec’ version “0.18.2” library?
I’m currently working on a Spring Boot project and I’m using the com.epages.restdocs-api-spec library version “0.18.2” to generate API documentation. However, I am having trouble documenting endpoints ...
Score of 1
1 answer
49 views
Facing issue with asciidoctor.jvm.convert 2.4.0 and spring docs 2.0.5 release Which is unable to load the child.html in the index html
test {
useJUnitPlatform()
outputs.dir snippetsDir
}
asciidoctor {
configurations "asciidoctorExtensions"
inputs.dir snippetsDir
dependsOn test
doLast {
copy{
from ("${asciidoctor....
Score of 1
1 answer
80 views
Facing issue where i am unable to load the child.html in the index html with asciidoctor.jvm.convert 2.4.0
I am using spring docs 2.0.5 release version
I am using gradle 8.6, and i refer to this example to configure asciidoctor -i refered below link
https://github.com/spring-projects/spring-...
Score of 0
1 answer
46 views
issue while creating war using gradle 8.6 the public/docs folder is not getting created
spring boot 2.7.6 having issue while creating war using
asciidoctor.jvm.convert 2.4.0 and spring docs 2.0.5
test {
useJUnitPlatform()
outputs.dir snippetsDir
}
asciidoctor {
configurations "...
Score of 0
1 answer
283 views
Generate ascii doc api documentation from spring rest docs using Spock
I'm trying to write Spock test cases for my Spring Boot application (version: 2.7.5), and I want to generate AsciiDoc documentation using Spring REST Docs. Can someone provide a sample working code ...
Score of 0
0 answers
545 views
restDocs requestParameters cannot find
import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
User
java: cannot find symbol
symbol: static requestParameters
location: class org.springframework....
Score of 0
0 answers
135 views
Handling Null ID in Spring Boot JPA Entity when Writing Spring REST Docs Tests
I'm currently working with Spring Boot and JPA, and I'm using the @Builder pattern for my entity classes. For my primary key field id, I'm using @Id and @GeneratedValue(strategy = GenerationType....
Score of 0
1 answer
75 views
Matching json values in an array using spring restdocs in random order
I am using Spring RestDocs to validate my REST APIs.
One API is returning an array of generated values based on some input. I want to verify that the generated values in the response are correct.
A ...
Score of 1
1 answer
154 views
How can I fix a RestDocumentationGenerationException: java.io.FileNotFoundException: /curl-request.adoc (Read-only file system) in my Spring Boot app?
Would you believe googling this returned a whopping two results!
I'm trying to use Spring REST Docs (spring-restdocs-mockmvc) to generate API documentation for my service.
Running on a macbook pro ...
Score of 0
0 answers
41 views
Start spring-restdocs locally
I want to run this project locally:
https://github.com/spring-projects/spring-restdocs
I cloned the project locally and I run ./gradlew asciidoctor successfully.
But now how I can run the project ...
Score of 0
0 answers
565 views
I don't know if MockMvc is not autowired when writing test code using spring rest docs
I tried to write a test code using 'rest docs' in Spring Boot with kotlin.
I am having an issue with injecting MockMvc to my test class. No qualifying bean of type
Shouldn't @AutoConfigureMockMvc, @...
Score of 1
1 answer
1588 views
Spring Boot 3 with RESTDOCS
I was using spring-restdocs with SB2.7.9
Now we migrated to SB3.0.6. I am using gradle plugin (kotlin DSL) id("org.asciidoctor.jvm.convert") version "3.3.2"
Libraries are versions:
...
Score of 0
2 answers
290 views
mockMVC test code I wrote call other controller's api (maybe)
First I ask for your understanding of my poor eng.
I'm writing test code for make api specification by Spring Rest Docs library.
plugins {
id 'java'
id 'org.springframework.boot' version '2.7....
Score of 0
1 answer
684 views
Spring REST Docs: how to documentation multipart form list parameter?
How to documentation form list parameter?
Controller
@PostMapping("/sample")
public void post(@ModelAttribute PostRequest request) {
// ...
}
@Data
public static class PostRequest {
...
Score of 2
1 answer
486 views
Adding extra information in Spring Rest-Docs using Attributes failing
I'm generating documentation for APIs that are written in Python. I am using Spring Rest-Docs for this which works flawless.
Now I must add a list of roles that are authorized to call the API to each ...
Score of 1
1 answer
6298 views
How to load openapi local files into swagger on localhost? (Files generated by restdocs)
I have my api documentation generated by restdocs through unit tests. Although it works fine for most of my needs, I'm still lacking a bit of the nice swagger features, so I was trying to have the ...
Score of 0
1 answer
357 views
Spring REST Docs - Add p12 certificate in Curl Snippet
I am using MockMVC and Spring REST docs and am trying to generate a curl snippet that has the certificate in it. I imagine the certificate portion of the curl statement should look something like:
--...
Score of 1
1 answer
325 views
Best practice to send the input request to POST endpoint
Iam creating a POST endpoint named /transactions which should accept the below input. What is the best practice to send the input request like the below? Should i use a request body or a input stream ...
Score of 0
1 answer
335 views
Is there any solution for converting openapi3 to Restdocs(adoc)?
I could convert openapi2 to adoc with Swagger2Markup, but it support only openapi2, not 3.
https://github.com/Swagger2Markup/swagger2markup/issues
and I read some issues on it, and i guess it still ...
Score of 2
2 answers
847 views
Spring boot document configuration properties
I'm trying to automatically document my configuration properties in order to create a html like the one on spring boot appendix for it's configuration.
I see that I can enable configuration metadata ...
Score of 0
1 answer
228 views
How to authenticate with a bearer token when using Spring Rest Docs
Can I use Spring RestDocs to document APIs when the authorization mode is bearer?
A pointer to a simple example would be appreciated, it doesn't seem the be available on the Spring RestDocs pages.
...
Score of 0
0 answers
372 views
Is there any way to mask body content in Spring Rest Docs?
I am using JWT authentication with Spring Security, where authentication requests have to contain the username and password in their body.
I do not want the credentials I use in the test to be ...
Score of 0
0 answers
111 views
how can I specify that an input parameter depends on another parameter
In my Rest Service i could have request country parameter by two way
On in subOject from main User Object and an other way friendly is country code in String
Could i in Spring RestsDocs says if ...
Score of 1
1 answer
354 views
[spring-rest-docs]: Problem documenting a Map<Object, Set<Object>>
I have a hard time trying to document the following:
{
"virtualFaxPermissions" : {
"SOME_RANDOM_UUID" : [ "SOME_SPECIFIC_PERMISSION" ]
}
}
I have tried to put a ...
Score of 0
0 answers
175 views
Open webpages generated by restdocs
I want to display static pages using Spring Boot. I tried this configuration:
plugins {
id "java"
id "org.asciidoctor.jvm.convert" version "3.3.2"
}
repositories ...
Score of 4
1 answer
7290 views
Springdoc with a generic return type
I have a custom Page to return when the user does a query with a Pageable. This Page has a generic parameter and I want to specify it in my Swagger documentation.
Here is the current result:
Where ...
Score of 0
1 answer
424 views
How to document a Map with Enum as key entry?
I am doing documentation for a REST service that returns this kind of JSON:
{
"CKM_RSA_PKCS_OAEP" : {
"keyType" : "RSA",
"canGenerateKey" : false,
...
Score of 0
1 answer
1514 views
How to document path parameters both in the uri and in the query string?
In a JUnit 5 test, I'm trying to document my Spring Boot application API with the following:
(...)
this.webTestClient = WebTestClient.bindToApplicationContext(applicationContext)
....
Score of 0
1 answer
703 views
Rest doc for PUT request with request param but without request body setting content type as form url encoded
I have noticed that rest doc (HttpRequestSnippet.java) is setting APPLICATION_FORM_URLENCODED_VALUE as content type for PUT with request parameter and without request body. This should be corrected, ...
Score of 1
2 answers
615 views
Specify custom snippet directory for spring-restdocs-asciidoctor?
I have configured a custom snippet directory with RestDocumentationExtension.
How can I specify this snippet directory for the spring-restdocs-asciidoctor?
Score of 0
1 answer
226 views
Creating snippet for shared model
Is it possible to generate snippet for a nested bean shared between different response structures ?
Address model
class Address {
String state;
Integer postcode;
}
Response from endpoint 1 (R1)
{
...
Score of 7
1 answer
3213 views
Configuring asciidoctor when using Spring Restdoc
I'm adopting Spring Rest Docs and the test successfully created *.adoc files.
I made api-guide.doc file in src/docs/asciidoc directory to create html, but when I run asciidoc as a gradle task, it ...
Score of 0
1 answer
292 views
Can we Document Model/entity with using Spring rest docs
Writing all fields with the snippets description is not reliable solution
is there any way to implement Model/Entity as a table with the fields and description, constraints, Type seprately.
...
Score of 0
1 answer
785 views
How to convert generated-snippets .adoc files to html in src/docs/asciidoc using gradle project
I am facing the issue while working with the asciidoc for my spring rest docs implemetation my adoc files as per my test cases is created in build/generated-snippets.
I am having issue with creating ...
Score of 0
2 answers
773 views
How to Disable Spring Rest Docs
PROBLEM I use Spring Rest Docs in my project. It is useful at development stage, but i don't want it to be available for ordinary users and search engines in production.
RESEARCH I see no robot meta ...
Score of 0
1 answer
175 views
How i can document inner collection constraints in spring auto restdocs
I'm trying to document inner constraint for Collections (NotBlank and Size) like:
@Valid
private List<@NotBlank @Size(min = 1, max = 100) String> someAnotherUsefulInformationList;
Can I do ...
Score of 0
1 answer
1604 views
Spring AutoConfigureRestDocs additional configuration
I am generating documentation using Spring REST docs and I am using the new annotation @AutoConfigureRestDocs instead of explicitly defining in the @BeforeEach method. The below test is currently ...
Score of 3
1 answer
2301 views
How to collapse TOC(table of contents) in spring RestDoc (asciidoc)?
I had used SpringRestDoc and want to collapse Table of Contents.
Below my index.adoc
= Service Rest Docs API Document
:doctype: book
:icons: font
:source-highlighter: highlightjs
:toc2: left
:theme: ...
Score of 0
1 answer
1262 views
When using spring rest docs, how do I make a newline in the description?
I tried \n or br tag to make a newline, but it doesn't work.
requestParameters(
parameterWithName("name").description("This is the description <br/> in the table.&...
Score of 0
1 answer
1457 views
Optional on response FieldDescriptor not working as expected
I'm having trouble documenting optional response fields with Spring Docs.
My test code:
mockMvc.perform(get("/foo").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
...
Score of 1
2 answers
2533 views
Spring webflux testing
I have a Spring webflux application with the service below.
@Configuration
public class RouterConfiguration {
@Autowired
private RegistrationHandler regHandler;
@Bean
public ...
Score of 0
1 answer
908 views
Spring webflux restdocs - By passing security for test cases
I am using Spring webflux security for my application and trying to write Spring webflux restdocs. Getting unauthorized error for test cases. Is there anyway to by pass security for rest doc test ...
Score of 0
1 answer
1129 views
Spring Rest Doc (Gradle) Snippets disappear upon build
Recently switch to Gradle from Maven.
Following this tutorial for continuous REST Doc build with Gradle. https://www.youtube.com/watch?v=k5ncCJBarRI&t=1490s
Snippets are generating just fine when ...
Score of 0
1 answer
546 views
Spring REST Docs + RequestBody + Prevent deep-level documentation of fields
i have problems with Spring REST Docs and preventing deep-level documentation of fields within a request body:
@Transactional
@RequestMapping(path = "/edit", method = RequestMethod.POST)
...
Score of 0
0 answers
1371 views
Spring rest docs request url shows value for path parameter instead of the parameter name
I use spring rest docs to document my api.
Now I want to document my document my path in the form of
.../accounts/{userId}
but I get
.../accounts/123
The test part look as follows:
mockMvc.perform(...
Score of 2
1 answer
318 views
Integration tests create files for the packaged jar
I'm generating spring-restdocs snippets with rest assured in my integration tests.
With maven and the failsafe plugin that defaults to the integration-test and verify phase. Problem is, that ...