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

Add validation to the target source and linking fields to verify they are valid backing columns in linking object #2144

Open
aaronburtle opened this issue Mar 29, 2024 · 1 comment
Assignees
Milestone

Comments

@aaronburtle
Copy link
Contributor

Relates to #1935

When we do our validation of the config in the RuntimeConfigValidator one of the things that we would like to validate is that all of the source and target fields in an entity's relationships are valid backing columns in the backend database to which they ought to belong. This is easy enough for non-linking fields, as they exist in the source and target entities. Since source and target entities are defined in our config file, we have data structures which hold the relevant information for easy retrieval during validation.

However, for linking objects this is not necessarily the case. Linking objects do not currently have to be defined as entities in our config, and therefore, to validate that the linking source and linking target fields that reference such a linking object are in fact valid columns within that linking object would require to go back to the backend and query the system tables. This is an expensive call and outside the scope of the RuntimeConfigValidator class. Therefore, we should pre-load this information into our data model so that we can quickly retrieve it at time of validation.

Once that is possible we can add the validation step to the validator.

@aaronburtle aaronburtle added this to the 1.2rc milestone Mar 29, 2024
@aaronburtle aaronburtle self-assigned this Mar 29, 2024
@seantleonard
Copy link
Contributor

"Book": {
  "source": "dbo.books",
  "relationships": {       
    "authors": {
      "cardinality": "many",
      "target.entity": "author",
      "source.fields": [ "id" ],
      "target.fields": [ "id" ],
      "linking.object": "dbo.books_authors",
      "linking.source.fields": [ "book_id" ],
      "linking.target.fields": [ "author_id" ]
    }
  }
}

where validation for existence of these values in the database can't be done currently:

      "linking.object": "dbo.books_authors",
      "linking.source.fields": [ "book_id" ],
      "linking.target.fields": [ "author_id" ]

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

2 participants