0

I am using hapi version 5.5.0 And I was working on @Create for MedicationKnowledge resource
I am using spring boot with gradle

Dependencies -

implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-server-openapi', version: '5.5.0'
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-base', version: '5.5.0'
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-r4', version: '5.5.0'
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-server', version: '5.5.0'

Code -

@Component
public class MedicationKnowledgeProvider implements IResourceProvider {

@Override
public Class<? extends IBaseResource> getResourceType() {
return MedicationKnowledge.class;
}

@Create()
public MethodOutcome create(@ResourceParam MedicationKnowledge medicationKnowledge) {

return null;

}

}

And I am calling this by using insomnia as POST request

http://localhost:8080/MedicationKnowledge

But in response I am getting -

{
        "resourceType": "OperationOutcome",
        "issue": [
                {
                        "severity": "error",
                        "code": "processing",
                        "diagnostics": "Unknown resource type 'error' - Server knows how to handle: [MedicationKnowledge, OperationDefinition]"
                }
        ]
}

I had debug It , and noticed that it is internally changing MedicationKnowlegde to error
Can anyone please help me with this?

UPDATE -

I am using another dependency and seems like it is causing the issue

implementation group: 'org.keycloak', name: 'keycloak-spring-boot-starter', version: '15.0.1'

Now the thing is I have to have this dependency, as I am using its functionality in some classes, so now the question mark is even bigger

1 Answers1

0

Try using @Create insteand of @Create()

Pradyskumar
  • 296
  • 1
  • 3
  • 15