Skip to content

Spring Data Rest: Wrong schema for request body in association controllers  #1082

Closed
@mathias-ewald

Description

@mathias-ewald

Describe the bug
When generating api-doc for association controllers (e.g. GET /doctors/{id}/clinics) the schema for the text/uri-list content type should not be a CollectionModel.

To Reproduce
Spring Boot: 2.4.1
Springdoc: 1.5.5

public class Doctor {
	...
	@Size(min = 1)
	@ManyToMany
	private Set<Clinic> clinics;
}

@CrossOrigin
public interface DoctorRepo extends CrudRepository<Doctor, UUID> {}

@CrossOrigin
public interface ClinicRepo extends CrudRepository<Clinic, UUID> {}
$ curl http://localhost:8080/v3/api-docs.yaml
...
  /doctors/{id}/clinics:
    get:
      tags:
      - doctor-property-reference-controller
      description: get-clinic-by-doctor-Id
      operationId: followPropertyReference-doctor-get_1
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/hal+json:
              schema:
                $ref: '#/components/schemas/CollectionModelClinic'
            text/uri-list:
              schema:
                $ref: '#/components/schemas/CollectionModelClinic'
        "404":
          description: Not Found
...

Expected behavior
I am not entirely sure what would be the correct way to represent text/uri-list. Probably as a string?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions