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

VRE | Investigate Schema Issues #95099

Closed
mjknight50 opened this issue Oct 16, 2024 · 3 comments
Closed

VRE | Investigate Schema Issues #95099

mjknight50 opened this issue Oct 16, 2024 · 3 comments
Assignees
Labels
backend engineering Engineering topics non-disability-benefits VRE-CH31 Veteran Readiness and Employment (CH31) zero-silent-failures Work related to eliminating silent failures ZSF:CodeReliability Changes to your code that handle silent errors in a way that they are no long silent.

Comments

@mjknight50
Copy link
Contributor

mjknight50 commented Oct 16, 2024

Overview

There is an ongoing issue with schema validation, especially for VR&E. This ticket is to track the work associated with the issue.

This issue spans multiple forms.

Related Issue

#83680

@mjknight50 mjknight50 self-assigned this Oct 17, 2024
@mjknight50 mjknight50 added backend VRE-CH31 Veteran Readiness and Employment (CH31) engineering Engineering topics labels Oct 17, 2024
@steele-lm steele-lm changed the title Add check for schema for VR&E VRE | Add check for schema Oct 28, 2024
@steele-lm steele-lm added non-disability-benefits zero-silent-failures Work related to eliminating silent failures ZSF:CodeReliability Changes to your code that handle silent errors in a way that they are no long silent. labels Oct 28, 2024
@mjknight50 mjknight50 reopened this Nov 13, 2024
@mjknight50 mjknight50 changed the title VRE | Add check for schema VRE | Investigate Schema Issues Nov 13, 2024
@mjknight50
Copy link
Contributor Author

mjknight50 commented Nov 15, 2024

Update on this issue. The gem file being used by the vets-api is called json-schema

Within vets-api, we use two specific functions in app/models/saved_claim.rb

There is no documentation for the functions:
https://github.com/voxpupuli/json-schema/blob/edb815ad358cd130ebca3216b35f1b7490e958cd/lib/json-schema/validator.rb#L275
https://github.com/voxpupuli/json-schema/blob/edb815ad358cd130ebca3216b35f1b7490e958cd/lib/json-schema/validator.rb#L279

It seems like fully_validate takes a given JSON payload and validates it against a schema.
Whereas fully_validate_schema just validates that the schema is valid.

We've using JSON::Validator.fully_validate_schema(schema, { errors_as_objects: true }) which works from what we can tell. Within the gem, that function calls fully_validate

Then, we've got JSON::Validator.fully_validate(schema, parsed_form, { errors_as_objects: true, clear_cache: })
Which is the same thing being called by fully_validate_schema but that one errors out.

On top of that all, the gem is no longer maintained. It seems like this one might have more support:
https://github.com/davishmcclurg/json_schemer

@mjknight50
Copy link
Contributor Author

@coope93 is proposing that we hide the fully_validate_schema behind a flipper for now.
department-of-veterans-affairs/vets-api#19468

@mjknight50
Copy link
Contributor Author

mjknight50 commented Nov 21, 2024

I've posted most of my findings to https://dsva.slack.com/archives/C053U7BUT27/p1732119843278369
An engineer from @shaunburdick or @dysbo team may pick this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend engineering Engineering topics non-disability-benefits VRE-CH31 Veteran Readiness and Employment (CH31) zero-silent-failures Work related to eliminating silent failures ZSF:CodeReliability Changes to your code that handle silent errors in a way that they are no long silent.
Projects
None yet
Development

No branches or pull requests

2 participants