Skip to content

Commit

Permalink
Add schema standard version to Libdoc JSON schema.
Browse files Browse the repository at this point in the history
Decided to go with Draft 2020-12 which is currently the latest version.
  • Loading branch information
pekkaklarck committed Apr 27, 2022
1 parent 804c8c9 commit c43fb46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/schema/libdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"keywords",
"typedocs"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"definitions": {
"DocumentationType": {
"title": "DocumentationType",
Expand Down
7 changes: 7 additions & 0 deletions doc/schema/libdoc_json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ class Libdoc(BaseModel):
dataTypes: dict = Field({}, description="Deprecated. Use 'typedocs' instead.")
typedocs: List[TypeDoc]

# pydantic doesn't add schema version automatically.
# https://github.com/samuelcolvin/pydantic/issues/1478
class Config:
schema_extra = {
'$schema': 'https://json-schema.org/draft/2020-12/schema'
}


if __name__ == '__main__':
path = Path(__file__).parent / 'libdoc.json'
Expand Down

0 comments on commit c43fb46

Please sign in to comment.