Skip to content

Commit 9f17e33

Browse files
committed
Add Python-Protobuf generator
We add a generator for a library which allows conversion from model instance to and from corresponding Protocol Buffers.
1 parent 39a2259 commit 9f17e33

File tree

37 files changed

+14503
-3
lines changed

37 files changed

+14503
-3
lines changed

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Call the generator with the appropriate target:
139139
140140
usage: aas-core-codegen [-h] --model_path MODEL_PATH --snippets_dir
141141
SNIPPETS_DIR --output_dir OUTPUT_DIR --target
142-
{csharp,cpp,golang,java,jsonschema,python,typescript,rdf_shacl,xsd,jsonld_context,protobuf}
142+
{csharp,cpp,golang,java,jsonschema,python,typescript,rdf_shacl,xsd,jsonld_context,protobuf,python_protobuf}
143143
[--version]
144144
145145
Generate implementations and schemas based on an AAS meta-model.
@@ -153,7 +153,7 @@ Call the generator with the appropriate target:
153153
specific code snippets
154154
--output_dir OUTPUT_DIR
155155
path to the generated code
156-
--target {csharp,cpp,golang,java,jsonschema,python,typescript,rdf_shacl,xsd,jsonld_context,protobuf}
156+
--target {csharp,cpp,golang,java,jsonschema,python,typescript,rdf_shacl,xsd,jsonld_context,protobuf,python_protobuf}
157157
target language or schema
158158
--version show the current version and exit
159159

aas_core_codegen/main.py

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import aas_core_codegen.xsd.main as xsd_main
1919
import aas_core_codegen.jsonld.main as jsonld_main
2020
import aas_core_codegen.protobuf.main as protobuf_main
21+
import aas_core_codegen.python_protobuf.main as python_protobuf_main
2122
from aas_core_codegen import run, specific_implementations
2223
from aas_core_codegen.common import LinenoColumner, assert_never
2324

@@ -38,6 +39,7 @@ class Target(enum.Enum):
3839
XSD = "xsd"
3940
JSONLD_CONTEXT = "jsonld_context"
4041
PROTOBUF = "protobuf"
42+
PYTHON_PROTOBUF = "python_protobuf"
4143

4244

4345
class Parameters:
@@ -169,6 +171,9 @@ def execute(params: Parameters, stdout: TextIO, stderr: TextIO) -> int:
169171
elif params.target is Target.PROTOBUF:
170172
return protobuf_main.execute(run_context, stdout=stdout, stderr=stderr)
171173

174+
elif params.target is Target.PYTHON_PROTOBUF:
175+
return python_protobuf_main.execute(run_context, stdout=stdout, stderr=stderr)
176+
172177
else:
173178
assert_never(params.target)
174179

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Generate the code for conversion from and to Protocol Buffers."""

0 commit comments

Comments
 (0)