Swagger and enum

100 Views Asked by At

I use spring boot 3.1.5 with springdoc-openapi

In a controller, I have

@GetMapping(value="/{recordType}")
public ReadRecordResponse readRecord( @PathVariable RecordType recordType) {
  ...
}

My data class

public enum RecordType {
    on, 
    off
}

This class is used by some other class

with i try to access swagger-ui/index.html, i get a 400

"detail":"Failed to convert 'recordType' with value: 'swagger-ui'"

I tried without success

@GetMapping(value="/{recordType}")
public ReadRecordResponse readRecord( @PathVariable @Schema(type="string", allowableValues = {"on", "off"}) RecordType recordType) {
  ...
}
0

There are 0 best solutions below