Forum Discussion

sandipspawar211's avatar
sandipspawar211
Frequent Visitor
3 years ago

How to use swagger for HAPI FHIR model for Spring boot FHIR API

Hi All,

 

I have written Spring boot FHIR API's which return HAPI FHIR model in response. Something like below:

@RequestMapping(value = "/v1/Patient", method= RequestMethod.GET, produces = "application/json")
public ResponseEntity<Patient> getPatient() {
...
ResponseEntity<Patient> responseEntity =
new ResponseEntity<>(p, HttpStatus.OK);
return responseEntity;
}

I am using springfox swagger library.

But swagger serializer not doing serialization correctly, getting the resource something like this in swagger UI:

{
  "active": true,
  "activeElement": {
    "booleanPrimitive": true,
    "dateTime": true,
    "disallowExtensions": true,
    "empty": true,
    "extension": [
      {
        "empty": true,
        "extension": [
          {}
        ],
        "formatCommentsPost": [
          "string"
        ],
.
..
...

How to resolve this? Can anyone please help with this?
Thanks in advance.

No RepliesBe the first to reply