Skip to content

Commit

Permalink
Add flag for no additional properties in definitions (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Oct 12, 2023
1 parent bbb378c commit e52353e
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/acsets/acsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ def make_schema(self, uri: Optional[str] = None):
"""
# TODO add description
schema = self.model.schema()
for part in schema["definitions"].values():
part["additionalProperties"] = False
schema["$schema"] = "http://json-schema.org/draft-07/schema#"
if uri is not None:
schema["$id"] = uri
Expand Down
4 changes: 4 additions & 0 deletions src/acsets/schemas/jsonschema/LabelledPetriNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,6 +33,7 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {
"sname": {
"title": "Sname",
Expand All @@ -41,6 +44,7 @@
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {
"tname": {
"title": "Tname",
Expand Down
4 changes: 4 additions & 0 deletions src/acsets/schemas/jsonschema/LabelledReactionNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,6 +33,7 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {
"concentration": {
"title": "Concentration",
Expand All @@ -45,6 +48,7 @@
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {
"rate": {
"title": "Rate",
Expand Down
4 changes: 4 additions & 0 deletions src/acsets/schemas/jsonschema/PetriNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,11 +33,13 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {},
"title": "S",
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {},
"title": "T",
"type": "object"
Expand Down
4 changes: 4 additions & 0 deletions src/acsets/schemas/jsonschema/PropertyLabelledPetriNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,6 +33,7 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {
"sname": {
"title": "Sname",
Expand All @@ -45,6 +48,7 @@
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {
"tname": {
"title": "Tname",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,6 +33,7 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {
"concentration": {
"title": "Concentration",
Expand All @@ -49,6 +52,7 @@
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {
"rate": {
"title": "Rate",
Expand Down
4 changes: 4 additions & 0 deletions src/acsets/schemas/jsonschema/PropertyPetriNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,6 +33,7 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {
"sprop": {
"title": "Sprop",
Expand All @@ -41,6 +44,7 @@
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {
"tprop": {
"title": "Tprop",
Expand Down
4 changes: 4 additions & 0 deletions src/acsets/schemas/jsonschema/PropertyReactionNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,6 +33,7 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {
"concentration": {
"title": "Concentration",
Expand All @@ -45,6 +48,7 @@
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {
"rate": {
"title": "Rate",
Expand Down
4 changes: 4 additions & 0 deletions src/acsets/schemas/jsonschema/ReactionNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"I": {
"additionalProperties": false,
"properties": {
"is": {
"title": "Is",
Expand All @@ -17,6 +18,7 @@
"type": "object"
},
"O": {
"additionalProperties": false,
"properties": {
"os": {
"title": "Os",
Expand All @@ -31,6 +33,7 @@
"type": "object"
},
"S": {
"additionalProperties": false,
"properties": {
"concentration": {
"title": "Concentration",
Expand All @@ -41,6 +44,7 @@
"type": "object"
},
"T": {
"additionalProperties": false,
"properties": {
"rate": {
"title": "Rate",
Expand Down
6 changes: 6 additions & 0 deletions src/acsets/schemas/jsonschema/SummationDecapode.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"Op1": {
"additionalProperties": false,
"properties": {
"op1": {
"title": "Op1",
Expand All @@ -21,6 +22,7 @@
"type": "object"
},
"Op2": {
"additionalProperties": false,
"properties": {
"op2": {
"title": "Op2",
Expand All @@ -43,6 +45,7 @@
"type": "object"
},
"Summand": {
"additionalProperties": false,
"properties": {
"summand": {
"title": "Summand",
Expand All @@ -57,6 +60,7 @@
"type": "object"
},
"TVar": {
"additionalProperties": false,
"properties": {
"incl": {
"title": "Incl",
Expand All @@ -67,6 +71,7 @@
"type": "object"
},
"Var": {
"additionalProperties": false,
"properties": {
"name": {
"title": "Name",
Expand All @@ -81,6 +86,7 @@
"type": "object"
},
"_": {
"additionalProperties": false,
"properties": {
"sum": {
"title": "Sum",
Expand Down

0 comments on commit e52353e

Please sign in to comment.