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

Update SemanticManifestValidator to expect a generic bound by the SemanticManifest Protocol #20

Closed
Tracked by #7
QMalcolm opened this issue Apr 27, 2023 · 0 comments · Fixed by #75
Closed
Tracked by #7

Comments

@QMalcolm
Copy link
Collaborator

QMalcolm commented Apr 27, 2023

Currently the SemanticManifestValidator (currently named ModelValidator) expects a UserConfiguredModel which is a concrete object. Initially we thought we should move to it expecting SemanticManifest protocol. However, in dbt-core we'll be writing nodes which extend the protocol definition. If we want to be able to write validation rules that can operate on the extensions and guarantee type safety, then we need to take it a step further. Thus the SemanticManifestValidator should instead operate on a generic bound by the SemanticManifest protocol.

Something like...

from typing import TypeVar
from dbt_semantic_interfaces.protocols import SemanticManifest


T = TypeVar("T", bound="SemanticManifest")
class SemanticManifestValidator:
  ...

  def validate(self, semantic_manifest: T) -> ValidationResults:
    ...
@QMalcolm QMalcolm changed the title Update SemanticManifestValidator to expect SemanticManifest Protocol Update SemanticManifestValidator to expect a generic bound by the SemanticManifest Protocol Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant