Skip to content

Commit

Permalink
wip: state + location should use oneOf
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Oct 11, 2024
1 parent 817e23d commit 8b88dca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/Allele.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
]
},
"state": {
"anyOf": [
"description": "An expression of the sequence state",
"oneOf": [
{
"$ref": "/ga4gh/schema/vrs/2.x/json/LiteralSequenceExpression"
},
Expand All @@ -69,8 +70,7 @@
{
"$ref": "/ga4gh/schema/vrs/2.x/json/LengthExpression"
}
],
"description": "An expression of the sequence state"
]
}
},
"required": [
Expand Down
7 changes: 3 additions & 4 deletions examples/pydantic_to_json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ class Allele(models.Allele, extra="forbid"):
class Config:
@staticmethod
def json_schema_extra(cls):
cls["properties"]["location"]["oneOf"] = cls["properties"]["location"][
"anyOf"
]
del cls["properties"]["location"]["anyOf"]
for prop in {"location", "state"}:
cls["properties"][prop]["oneOf"] = cls["properties"][prop]["anyOf"]
del cls["properties"][prop]["anyOf"]

expressions: Optional[List[models.Expression]] = Field(None, ordered=False)
maturity: Literal["draft"] = Field("draft", frozen=True)
Expand Down

0 comments on commit 8b88dca

Please sign in to comment.