Skip to content

Commit

Permalink
Merge pull request #83 from ethdebug/smarter-schemas
Browse files Browse the repository at this point in the history
Replace a few `oneOf`s with if/then/else
  • Loading branch information
gnidan authored Mar 29, 2024
2 parents 7af6291 + 102facc commit 574bac6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
16 changes: 13 additions & 3 deletions schemas/type.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ then:
title: KnownType
description:
Then the object must adhere to exactly one known kind of type
oneOf:
- $ref: "schema:ethdebug/format/type/elementary"
- $ref: "schema:ethdebug/format/type/complex"
allOf:
- if:
properties:
kind:
$ref: "schema:ethdebug/format/type/elementary#/$defs/Kind"
then:
$ref: "schema:ethdebug/format/type/elementary"
- if:
properties:
kind:
$ref: "schema:ethdebug/format/type/complex#/$defs/Kind"
then:
$ref: "schema:ethdebug/format/type/complex"

else:
type: object
Expand Down
11 changes: 8 additions & 3 deletions schemas/type/wrapper.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ description:
type: object
properties:
type:
oneOf:
- $ref: "schema:ethdebug/format/type"
- $ref: "schema:ethdebug/format/type/reference"
# Discriminate between reference and type based on presence of `id`
if:
required:
- id
then:
$ref: "schema:ethdebug/format/type/reference"
else:
$ref: "schema:ethdebug/format/type"

required:
- type
Expand Down

0 comments on commit 574bac6

Please sign in to comment.