question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create Kotlin DSL for Spring RestDocs

See original GitHub issue

I’ve been working on a Kotlin DSL for restDocs and have converted a number of samples to demonstrate it.

I would love to contribute the DSL into the spring-restdocs project. Would you be interested in that DSL? (I also wanted to contribute the base MockMVC DSL to spring test, but that is a different project)

Example DSL:

    @Test
    fun indexExample() {
        this.mockMvc.performGet("/") {
            expect { status { isOk } }
            document(documentationHandler) {
                "notes" link { description("The <<resources-notes,Notes resource>>") }
                "tags" link { description("The <<resources-tags,Tags resource>>") }
                response {
                    "Content-Type" header { description("The Content-Type of the payload, e.g. `application/hal+json`") }
                    "_links" subsection { description("<<resources-index-links,Links>> to other resources") }
                }
            }
        }
    }

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:29 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
sdeleuzecommented, Mar 4, 2019

I agree with @jnizet, the inconsistency between infix and non infix form is an issue, which is also present with andReturn(), so I have removed it via this commit.

Snapshot builds of Spring Framework 5.2.0.BUILD-SNAPSHOT are available on https://repo.spring.io./snapshot.

2reactions
checkettscommented, Feb 19, 2019

I’m also in favor of @jnizet 's direction. So I’ll let him lead on his proposal while I focus on https://github.com/spring-projects/spring-framework/pull/1951

I like that the focus is ease of discoverabiliy, readability, and allowing extension points for further custom extension functions

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get started with Spring Boot and Kotlin
Start by creating a Spring Boot project with Kotlin using IntelliJ IDEA. See also. Look through our Java to Kotlin (J2K) interop and...
Read more >
spring-projects/spring-restdocs - Gitter
Atm I use the openapi spec during pre-development to discuss what we are planning to build with the analists. To define models and...
Read more >
Spring Cloud Contract Features
Contract DSL in Kotlin. To get started with writing contracts in Kotlin you would need to start with a (newly created) Kotlin Script...
Read more >
spring-restdocs-mockmvc : 2.0.4.RELEASE - Maven Central
org.springframework.restdocs:spring-restdocs-mockmvc: 2.0.4.RELEASE ... Gradle Kotlin DSL github.com/gradle/kotlin-dsl. content_copy ... Bazel bazel.build.
Read more >
Upgrading asciidoctor.convert to asciidoctor.jvm.convert
... asciidoctorExt by configurations.creating dependencies { asciidoctorExt("org.springframework.restdocs:spring-restdocs-asciidoctor:2.0.5.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found