Skip to content

Expose @Id fields for entity with spring-data-rest/springdoc-openapi-data-rest #1146

Closed
@janderssonse

Description

@janderssonse

Is your feature request related to a problem? Please describe.

Background:

We have an 'REST api based on mostly spring-data-rest - An Entity field @id in configured to be exposed with a configuration on the Spring RepositoryRestConfiguration - exposeIdsFor(ENTITY.class). All well there but,,,

The same @id field is not visible in the documentation generated for the same Entity model with springdoc-openapi-data, since v1.5.6. I have tried setting hidden=false directly on it using the @Schema-annotation, like this.

@Schema(
description = "The Internal Job Identity", example = "fb2baa17-8972-451b-bb1e-1bc773283476",
accessMode = Schema.AccessMode.READ_ONLY, hidden=false, defaultValue = "A random UUID"
)
@id val id: UUID = UUID.randomUUID(),

  • What is the actual result using OpenAPI Description (yml or json)?

The field with @id is missing, even though we set hidden=false on it

Describe the solution you'd like

openapi-spring-rest-data should respect the RepositoryRestConfiguration - exposeIdsFor(ENTITY.class) configuration.

OR

allow an configuration like in Spring-rest-data to expose @ids, for example, springdocRespositoryRestConfiguration - exposeIdsFor(

OR

respect that if the hidden=false is set on on an @id field and expose it.

Describe alternatives you've considered

  • Searched in the docs, looked at a few examples, tried setting hidden=false on the @Schema for the @id field.

The @id field was exposed automatically up until version 1.5.5, but after 1.5.6 of the libs it is gone.

Additional context
The @id field is not visible ...

Skärmbild från 2021-04-25 11-23-51

Skärmbild från 2021-04-25 11-23-05

Note: I'm using the following dependencies:

//openapi generation
implementation("org.springdoc:springdoc-openapi-ui:1.5.7")
implementation("org.springdoc:springdoc-openapi-kotlin:1.5.7")
implementation("org.springdoc:springdoc-openapi-data-rest:1.5.7")
implementation("org.springdoc:springdoc-openapi-hateoas:1.5.7")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions