Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mathias-ewald opened this issue Mar 2, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@mathias-ewald
Copy link

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?!

@bnasslahsen
Copy link
Collaborator

@mathias-ewald,

Agree :)

This was referenced Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants