Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] dateTime not parsed correctly #508

Open
sneljasper opened this issue May 11, 2022 · 2 comments
Open

[BUG] dateTime not parsed correctly #508

sneljasper opened this issue May 11, 2022 · 2 comments

Comments

@sneljasper
Copy link

Describe the bug
dateTime regex does not match whole string, causing it to accept faulty input.

Changing
^-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?
to
^-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?$

fixes this (note $ at the end).

Severity
Major

Steps to reproduce the behavior:
This request goes through succesfully:

POST /Schedule
content-type: application/json

{
 "actor": [
  {
   "reference": "Practitioner/some-practitioner"
  }
 ],
 "planningHorizon": {
  "end": "2022-05-11T17:00:03 sdoifhd",
  "start": "2022-05-11T17:00:03420"
 },
 "resourceType": "Schedule",
}

Expected behavior

422 
resourceType: OperationOutcome
text:
  status: generated
  div: Invalid resource
issue:
  - severity: fatal
    code: invalid
    expression:
      - Schedule.planningHorizon.end
    diagnostics: >-
      expected format
      ^-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?$

Versions:

  • Aidbox image version:
    aidboxone:edge v:2204.123746db

Additional context

@sneljasper sneljasper added the bug label May 11, 2022
@KGOH
Copy link
Contributor

KGOH commented May 12, 2022

@jaspersnelmeditools please define box_compatibility_validation_json__schema_regex="#{:fhir-datetime}" variable to enable regexp with $. Try it out and let us know if it works as expected

@Nesmeshnoy Nesmeshnoy added validation and removed bug labels May 12, 2022
@Nesmeshnoy
Copy link
Contributor

@jaspersnelmeditools did you check it? Does it work on your side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants