Fixed invalid expiration date bug in Create/Update Legal Tag API calls

All Submissions:


  • [YES] I have added an explanation of what changes in this merge do and why we should include it?
  • [YES] I have updated the documentation accordingly.
  • [YES] I have added tests to cover my changes.
  • [YES] All new and existing tests passed.
  • [YES] My code follows the code style of this project.
  • [YES] I ran lint checks locally prior to submission.

What is the current behavior?


When given a long number for ExpirationDate e.g. 5555555555555555 deserializer converts it in a date (178018-07-19) with 6 digit year value. Although Legal tags get created with this date value but Get call later fails because the method expects the date to be in the "yyyy-mm-dd" format. Please refer the link below for details of issue.

Legal Service: POST and PUT Calls Allow Invalid Date Format Causing GET Calls to Fail (#99) · Issues · OSDU / OSDU Data Platform / Security and Compliance / Legal · GitLab

What is the new behavior?


Added method to validate length of year part in deserialized expiration date passed for create/update legal tag. If the year length is not equal to 4 request fails with code 400 and Message ""Expiration Date has invalid year <year part>."

Annotation to deserialize the date was missing in model used for Update Legal Tag. so added that as well.

Added unit test to test the expected behavior if a large numeric value is passed for ExpirationDate.

Added unit test for model UpdateLegalTag to test ExpirationDateDeserializer is correctly deserializing the expiration date and @JsonFormat annotation correctly formats the expiration date during deserialization.

Does this introduce a breaking change?


  • [YES]

Any relevant logs, error output, etc?


(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Other information


Edited by Ashutosh Rai

Merge request reports

Loading