Springdoc-openapi: Springdoc OpenAPI does not work with spring data rest

Created on 19 Dec 2019  路  8Comments  路  Source: springdoc/springdoc-openapi

I have a AccountRepository annotated with @RepositoryRestResource, but the Springdoc seems does not work to expose API documentation for Spring data rest. Is it not supported or this is a bug?

@RepositoryRestResource
public interface AccountRepository extends JpaRepository<Account, UUID> {

}

Most helpful comment

@bnasslahsen Thanks for clarification!

That's really unfortunate as this would be an insanely powerful feature. For production and even more for prototyping.

May I ask: Why it this not working? Can't it "just" honor the endpoitns genereate by @RepositoryRestResource as well?

What would it take to make this export work?

All 8 comments

Hi @seedarren,

There no support planned to @RepositoryRestResource annotations of spring data rest.
You need to use OAS3 annotations such as @operation

This is rather explicit over magic Auto generation that tends to have issues.
You can also contribute to migrate to add the support for @RepositoryRestResource out of the box.

I think it would be good idea to gather such tasks in one common place with the topic: No planned support, contribute if you want to have it

@Marx2 does this mean that what I am trying (see https://stackoverflow.com/questions/59868163/why-is-springfox-not-exposing-repositoryrestresource) cannot work?

Yes, it cannot work, as there is no automatic documentation g茅n茅ration for spring-data-rest using springdoc-openapi.

@bnasslahsen Thanks for clarification!

That's really unfortunate as this would be an insanely powerful feature. For production and even more for prototyping.

May I ask: Why it this not working? Can't it "just" honor the endpoitns genereate by @RepositoryRestResource as well?

What would it take to make this export work?

spring-data-rest entities endpoints are dynamically generated at runtime,
Spring Data REST dynamically creates an implementation of this interface, when you call the spring-data-rest endpoint and not on the application startup.

You could solve this adding the _springdoc-openapi-data-rest_ dependency

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-data-rest</artifactId>
    <version>1.4.8</version>
</dependency>

image

I'm using spring-boot 2.2.6 and works like charm :)

You could find more info in https://springdoc.org/

You could solve this adding the _springdoc-openapi-data-rest_ dependency

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-data-rest</artifactId>
    <version>1.4.8</version>
</dependency>

image

I'm using spring-boot 2.2.6 and works like charm :)

You could find more info in https://springdoc.org/

help me i'm so confuse

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amorenew picture amorenew  路  5Comments

GrmpfNarf picture GrmpfNarf  路  3Comments

flamestro picture flamestro  路  3Comments

kfirfer picture kfirfer  路  5Comments

krummerd picture krummerd  路  5Comments