Closed lschmierer closed 3 years ago
How is _targetProperty
used here??? Is it just for information purposes for users of FHIR.js? Doesn't seem that _targetProperty
is used internally in any way...
Ah yes, I am sorry. Should haven given more context.
I needed _targetProperty
for a GraphQL schema generator I am currently developing.
More precisely to add schema directives like
type AccountResource implements Resource & DomainResource {
resourceType: String!
...
subject: [Reference] @target(profiles: ["Patient", "Device", "Practitioner", "PractitionerRole", "Location", "HealthcareService", "Organization"])
...
I am using https://github.com/lantanagroup/FHIR.js/blob/master/profiles/types.json as base for schema generation.
The GraphQL generator will be published open source soon.
I will look into enhancing the FHIR.js validation logic https://github.com/lantanagroup/FHIR.js/blob/master/validator.ts to also use _targetProperty
for validating references.
This way both out projects can improve from the new addition.
Very good. Makes sense. Would love to see a PR for validation! I've merged your PR... Do you need a new patch-release made on NPM, or are you good with just merging?
In many cases it is not possible to validate the reference target, without resolving the references object. Does it make sense ti implement validation for such cases where the type is explicitly defined in the reference?
Yes. I would only worry about validating references that are relative. I would bother (right now) trying to validate a reference to an identifier, or a reference to a canonical url.
This PR adds a
_targetProfiles
field toParsedProperty
._targetProfiles
is only setif Element type == 'Reference'
.