hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

RuleBuilder requirements does not fit javadoc description of ResourceDef #1490

Open jvitrifork opened 5 years ago

jvitrifork commented 5 years ago

when using the rulebuilder on extended profiled resource classes, the rulebuilder fails on the following check: https://github.com/jamesagnew/hapi-fhir/blob/dff2fdd3cfb07fcb6e64826e17c37f87768b63f7/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/auth/RuleBuilder.java#L650 , as my extended class does not have a name, which should not be required according to https://github.com/jamesagnew/hapi-fhir/blob/882e0853df4381e19ad5503654ef028fe5b9a8de/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java#L41

jamesagnew commented 5 years ago

Hmm, yeah.. That code in RuleBulder is kind of a lazy implementation of the resource name scanner, to work around the fact that we don't have a FhirContext available (it's the thing that would be able to answer that question definitively and has logic for understanding the blank name() attribute, etc).

Probably the right solution here is to have a constructor of RuleBuilder that accepts a FhirContext obect...