Skip to content

Commit

Permalink
python: Remove inline context
Browse files Browse the repository at this point in the history
Instead of encoding the entire context and context decoder in the python
bindings, capture the compacted versions of each string at code
generation time and pass them to the encoder/decoder
  • Loading branch information
JPEWdev committed Mar 22, 2024
1 parent b6491f6 commit bcb1572
Show file tree
Hide file tree
Showing 4 changed files with 379 additions and 793 deletions.
4 changes: 2 additions & 2 deletions src/shacl2code/lang/templates/jsonschema.j2
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
"allOf": [
{
"properties": {
"{{ class.id_property or context.compact("@id") }}": { "$ref": "#/$defs/{{ class.node_kind.split("#")[-1] }}" },
"{{ class.id_property or "@id" }}": { "$ref": "#/$defs/{{ class.node_kind.split("#")[-1] }}" },
"{{ context.compact("@type") }}": { "const": "{{ context.compact_vocab(class._id) }}" }
}{%- if class.node_kind == SH.IRI %},
"required": ["{{ class.id_property or context.compact("@id") }}"]
"required": ["{{ class.id_property or "@id" }}"]
{%- endif %}
},
{ "$ref": "#/$defs/{{ varname(class.clsname) }}_props" }
Expand Down
Loading

0 comments on commit bcb1572

Please sign in to comment.