validators of metadata dont check description property for emptyness

Hi there,

Ive just ran into an issue when creating a new ConceptSource in the legacyui.

table concept_source’s column description has a not null constraint.

The ConceptSourceValidator however does not test for an empty description property. The user does gets a an exception like this

Opened a ticket

https://issues.openmrs.org/browse/TRUNK-4953

Now I first thought that this might affect other OpenmrsMetadata subtypes.

Quick look at HL7SourceValidator shows that an empty description does not fail validation. However the HL7Source.hbm.xml and the table hl7_source do not require the description. It can be null. So this seems to be good.

So just wanted to know if description which is inherited from OpenmrsMetadata is simply not required for all Metadata subtypes?

The base implementation

suggest that description is not generally required to be non-null.

I don’t think description is always required. (Personally I don’t think it should ever be required, but I guess the API disagrees with me in lots of cases.)

So, I think the ticket should be to look at each metadata class and ensuring that its validator’s behavior with respect to the description property matches what the DB requires.

am with you on this.

I adapted the ticket so its only about this specific case of the ConceptSource.description which is required by the DB (its fixed now).