-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #741 from common-workflow-language/adjust-is-subtype
Implement smarter `is_subtype` logic
- Loading branch information
Showing
8 changed files
with
258 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
$base: "https://example.com/nested_schema#" | ||
|
||
$namespaces: | ||
bs: "https://example.com/base_schema#" | ||
dv: "https://example.com/derived_schema#" | ||
|
||
$graph: | ||
|
||
- $import: avro_subtype.yml | ||
|
||
- type: record | ||
name: AbstractContainer | ||
abstract: true | ||
doc: | | ||
This is an abstract container thing that includes an AbstractThing field | ||
fields: | ||
override_me: | ||
type: bs:AbstractThing | ||
jsonldPredicate: "bs:override_me" | ||
|
||
|
||
- type: record | ||
name: ExtendedContainer | ||
extends: AbstractContainer | ||
doc: | | ||
An extended version of the abstract container that implements an extra field | ||
and uses an ExtendedThing to override the original field | ||
fields: | ||
extra_field: | ||
type: | ||
type: array | ||
items: [string] | ||
override_me: | ||
type: dv:ExtendedThing | ||
jsonldPredicate: "bs:override_me" |
35 changes: 35 additions & 0 deletions
35
schema_salad/tests/test_schema/avro_subtype_nested_bad.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
$base: "https://example.com/nested_schema#" | ||
|
||
$namespaces: | ||
bs: "https://example.com/base_schema#" | ||
dv: "https://example.com/derived_schema#" | ||
|
||
$graph: | ||
|
||
- $import: avro_subtype_bad.yml | ||
|
||
- type: record | ||
name: AbstractContainer | ||
abstract: true | ||
doc: | | ||
This is an abstract container thing that includes an AbstractThing field | ||
fields: | ||
override_me: | ||
type: bs:AbstractThing | ||
jsonldPredicate: "bs:override_me" | ||
|
||
|
||
- type: record | ||
name: ExtendedContainer | ||
extends: AbstractContainer | ||
doc: | | ||
An extended version of the abstract container that implements an extra field | ||
and uses an ExtendedThing to override the original field | ||
fields: | ||
extra_field: | ||
type: | ||
type: array | ||
items: [string] | ||
override_me: | ||
type: dv:ExtendedThing | ||
jsonldPredicate: "bs:override_me" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
$base: "https://example.com/recursive_schema#" | ||
|
||
$namespaces: | ||
bs: "https://example.com/base_schema#" | ||
|
||
$graph: | ||
|
||
- $import: "metaschema_base.yml" | ||
|
||
- type: record | ||
name: RecursiveThing | ||
doc: | | ||
This is an arbitrary recursive thing that includes itself in its fields | ||
fields: | ||
override_me: | ||
type: RecursiveThing | ||
jsonldPredicate: "bs:override_me" | ||
|
||
|
||
- type: record | ||
name: ExtendedThing | ||
extends: RecursiveThing | ||
doc: | | ||
An extended version of the recursive thing that implements an extra field | ||
fields: | ||
field_one: | ||
type: | ||
type: array | ||
items: [string] | ||
override_me: | ||
type: ExtendedThing | ||
jsonldPredicate: "bs:override_me" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
$base: "https://example.com/union_schema#" | ||
|
||
$namespaces: | ||
bs: "https://example.com/base_schema#" | ||
dv: "https://example.com/derived_schema#" | ||
|
||
$graph: | ||
|
||
- $import: avro_subtype.yml | ||
|
||
- type: record | ||
name: AbstractContainer | ||
abstract: true | ||
doc: | | ||
This is an abstract container thing that includes an AbstractThing | ||
type in its field types | ||
fields: | ||
override_me: | ||
type: [int, string, bs:AbstractThing] | ||
jsonldPredicate: "bs:override_me" | ||
|
||
|
||
- type: record | ||
name: ExtendedContainer | ||
extends: AbstractContainer | ||
doc: | | ||
An extended version of the abstract container that implements an extra field | ||
and contains an ExtendedThing type in its overridden field types | ||
fields: | ||
extra_field: | ||
type: | ||
type: array | ||
items: [string] | ||
override_me: | ||
type: [int, dv:ExtendedThing] | ||
jsonldPredicate: "bs:override_me" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
$base: "https://example.com/union_schema#" | ||
|
||
$namespaces: | ||
bs: "https://example.com/base_schema#" | ||
dv: "https://example.com/derived_schema#" | ||
|
||
$graph: | ||
|
||
- $import: avro_subtype_bad.yml | ||
|
||
- type: record | ||
name: AbstractContainer | ||
abstract: true | ||
doc: | | ||
This is an abstract container thing that includes an AbstractThing | ||
type in its field types | ||
fields: | ||
override_me: | ||
type: [int, string, bs:AbstractThing] | ||
jsonldPredicate: "bs:override_me" | ||
|
||
|
||
- type: record | ||
name: ExtendedContainer | ||
extends: AbstractContainer | ||
doc: | | ||
An extended version of the abstract container that implements an extra field | ||
and contains an ExtendedThing type in its overridden field types | ||
fields: | ||
extra_field: | ||
type: | ||
type: array | ||
items: [string] | ||
override_me: | ||
type: [int, dv:ExtendedThing] | ||
jsonldPredicate: "bs:override_me" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters