Skip to content

Commit

Permalink
added extends together with embed test
Browse files Browse the repository at this point in the history
  • Loading branch information
trisch-me committed Jun 27, 2024
1 parent 60c9921 commit f489b30
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 6 deletions.
7 changes: 1 addition & 6 deletions crates/weaver_resolved_schema/src/lineage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,7 @@ impl AttributeLineage {
}
}

/// Determines the value of the tags field by evaluating the presence of
/// a local value. If a local value is provided, it is used, and the tags
/// field's lineage is marked as local. Otherwise, the specified parent
/// value is used, and the tags field's lineage is marked as inherited
/// from the parent.
/// This method updates the lineage information for the tags field to
/// This method updates the lineage information for the prefix field to
/// reflect the source of its value.
pub fn prefix(&mut self, local_value: &bool, parent_value: &bool) -> bool {
if *local_value {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test adding a prefix to the references in attributes together with extends keyword.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"name": "client.id",
"type": "string",
"brief": "some client id\n",
"examples": [
"a.einstein"
],
"requirement_level": "recommended",
"stability": "experimental"
},
{
"name": "geo.lat",
"type": "string",
"brief": "latitude of the geo coordinates.\n",
"examples": [
"123.456"
],
"requirement_level": "recommended",
"stability": "experimental"
},
{
"name": "geo.lon",
"type": "string",
"brief": "longitude of the geo coordinates.\n",
"examples": [
"234.456"
],
"requirement_level": "recommended",
"stability": "experimental"
},
{
"name": "geo.country",
"type": "string",
"brief": "country of the geo coordinates.\n",
"examples": [
"US"
],
"requirement_level": "recommended",
"stability": "experimental"
},
{
"name": "geo.lat",
"type": "string",
"brief": "this is ref attribute",
"examples": [
"123.456"
],
"requirement_level": "recommended",
"stability": "experimental"
},
{
"name": "geo.country",
"type": "string",
"brief": "this is ref country attribute",
"examples": [
"US"
],
"requirement_level": "recommended",
"stability": "experimental"
},
{
"name": "client.geo.lat",
"type": "string",
"brief": "My own latitude",
"examples": [
"123.456"
],
"requirement_level": "recommended",
"stability": "experimental",
"prefix": true
},
{
"name": "client.geo.lat",
"type": "string",
"brief": "this is embedded attribute",
"examples": [
"123.456"
],
"requirement_level": "recommended",
"stability": "experimental"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
{
"registry_url": "https://127.0.0.1",
"groups": [
{
"id": "registry.client",
"type": "attribute_group",
"brief": "Describes information about the client.",
"prefix": "client",
"attributes": [
0,
6
],
"lineage": {
"source_file": "data/registry-test-11-prefix-refs-extends/registry/client.yaml",
"attributes": {
"client.geo.lat": {
"source_group": "registry.geo",
"inherited_fields": [
"examples",
"note",
"requirement_level",
"stability"
],
"locally_overridden_fields": [
"brief"
]
}
}
}
},
{
"id": "registry.geo",
"type": "attribute_group",
"brief": "Attributes describing geo.",
"prefix": "geo",
"attributes": [
1,
2,
3
],
"lineage": {
"source_file": "data/registry-test-11-prefix-refs-extends/registry/geo.yaml"
}
},
{
"id": "usage",
"type": "attribute_group",
"brief": "Attributes for test.",
"prefix": "usage",
"attributes": [
0,
2,
4,
7
],
"lineage": {
"source_file": "data/registry-test-11-prefix-refs-extends/registry/usage.yaml",
"attributes": {
"client.geo.lat": {
"source_group": "registry.client",
"inherited_fields": [
"examples",
"note",
"requirement_level",
"stability"
],
"locally_overridden_fields": [
"brief"
]
},
"client.id": {
"source_group": "registry.client",
"inherited_fields": [
"brief",
"examples",
"note",
"requirement_level",
"stability"
]
},
"geo.lat": {
"source_group": "registry.geo",
"inherited_fields": [
"examples",
"note",
"requirement_level",
"stability"
],
"locally_overridden_fields": [
"brief"
]
},
"geo.lon": {
"source_group": "registry.geo",
"inherited_fields": [
"brief",
"examples",
"note",
"requirement_level",
"stability"
]
}
}
}
},
{
"id": "usage2",
"type": "attribute_group",
"brief": "Attributes for test.",
"prefix": "usage2",
"attributes": [
0,
2,
4,
5,
7
],
"lineage": {
"source_file": "data/registry-test-11-prefix-refs-extends/registry/usage2.yaml",
"attributes": {
"client.geo.lat": {
"source_group": "registry.client",
"inherited_fields": [
"examples",
"note",
"requirement_level",
"stability"
],
"locally_overridden_fields": [
"brief"
]
},
"client.id": {
"source_group": "registry.client",
"inherited_fields": [
"brief",
"examples",
"note",
"requirement_level",
"stability"
]
},
"geo.country": {
"source_group": "registry.geo",
"inherited_fields": [
"examples",
"note",
"requirement_level",
"stability"
],
"locally_overridden_fields": [
"brief"
]
},
"geo.lat": {
"source_group": "registry.geo",
"inherited_fields": [
"examples",
"note",
"requirement_level",
"stability"
],
"locally_overridden_fields": [
"brief"
]
},
"geo.lon": {
"source_group": "registry.geo",
"inherited_fields": [
"brief",
"examples",
"note",
"requirement_level",
"stability"
]
}
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
groups:
- id: registry.client
prefix: client
type: attribute_group
brief: "Describes information about the client."
attributes:
- id: id
type: string
stability: experimental
brief: >
some client id
examples: ['a.einstein']
- ref: geo.lat
prefix: true
brief: My own latitude
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
groups:
- id: registry.geo
brief: Attributes describing geo.
type: attribute_group
prefix: geo
attributes:
- id: lat
type: string
stability: experimental
brief: >
latitude of the geo coordinates.
examples: ["123.456"]
- id: lon
type: string
stability: experimental
brief: >
longitude of the geo coordinates.
examples: [ "234.456" ]
- id: country
type: string
stability: experimental
brief: >
country of the geo coordinates.
examples: [ "US" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
groups:
- id: usage
brief: Attributes for test.
type: attribute_group
prefix: usage
attributes:
- ref: geo.lat
brief: this is ref attribute
- ref: client.id
- ref: geo.lon
- ref: client.geo.lat
brief: this is embedded attribute
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
groups:
- id: usage2
brief: Attributes for test.
type: attribute_group
prefix: usage2
extends: usage
attributes:
- ref: geo.country
brief: this is ref country attribute

0 comments on commit f489b30

Please sign in to comment.