Closed gillistephan closed 2 years ago
Hi @gillistephan , Thanks for your message! I had a look at the design docs and the PoC -- there's some cool stuff rolling on :-).
As I do not have the insights in the current process, it is sometimes hard to understand the concepts of different types (e.g. RefTypeAnnotation) without context.
A couple of colleagues and I formed a "Task force Typing" within UAG Verwaltungsschale in order to come up with a clearer and easier to understand approach to typing in the meta-model. There is actually quite a lot going on, and we have a couple of proposals lining up. Hence the meta-model itself is kind of a moving target at the moment.
Let's schedule a call via email, and then I can sync you up on the current status.
This equally applies for the AAS itself, its REST-Documentation etc., as I find it cumbersome to go through the PDFs to gather all the information (like Constraints), [...]
I am actually working on converting the Part 1 to antora (a static site builder based on asciidoc). We'll get there -- but, as you can see, there is so much going on that we can't keep up with all the initiatives. The first step is to convert the Word document as-is to asciidoc. It would be indeed cool to use the generator and automatically generate the class tables as well. At the moment we are still waiting for the official acknowledgment that a well-written PDF book is not required anymore.
Regardless of the book, it would be actually pretty cool to have the meta-model in a "browsable" form. Would you be interested on working on it?
Hey @mristin, I see. I think thats a smart approach :) I have never worked with antora and asciidoc so far. But looks good. Sure I can do that. Is there any preferences about the tech or should that be something, that lives anyway on its own, where I can decide on how to do it? - I can also make a PoC here and then we see if it meets the requirements.
I am pretty free the upcoming weeks. So just shoot me an E-Mail.
(We'll discuss further steps over a video call.)
I ll finished the PoC. Most notably, I added the Unmarshal and Marshal functions and adopted the Decode / Encode receiver methods in that way, that it can be used as a drop in replacement for the encoding/json library. Motivation was the use case to support easy adpoption of third party tooling like GRPC-Gateway via CustomMarshalers.
import (
"io"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
json "aascore/json"
)
type GWJSONMarshaler struct{}
func (m *GWJSONMarshaler) ContentType() string {
return "application/json"
}
func (m *GWJSONMarshaler) Marshal(v interface{}) ([]byte, error) {
return json.Marshal(v)
}
func (m *GWJSONMarshaler) Unmarshal(data []byte, v interface{}) error {
return json.Unmarshal(data, v)
}
func (m *GWJSONMarshaler) NewDecoder(r io.Reader) runtime.Decoder {
return json.NewDecoder(r)
}
func (m *GWJSONMarshaler) NewEncoder(w io.Writer) runtime.Encoder {
return json.NewEncoder(w)
}
// Usage
gwMuxOpts := runtime.WithMarshalerOption(runtime.MIMEWildcard, new(GWJSONMarshaler))
When using this, it doesn't matter if you pass AAS-Meta-Model types or not. If so, it will be de/encoded according to the specs.
Closing this for now. We can discuss this PoC at any point when there is more clarity.
Hi all,
after receiving your e-Mail @mristin, I started playing around a little bit with the generator. As I was coding anyway some stuff in Go, I implemented a first PoC for Go. My PoC is currently able to generate the structure as well as the code for Jsonization (De-/Serialization) as far as I was able to understand the current structure of the meta-model. As I do not have the insights in the current process, it is sometimes hard to understand the concepts of different types (e.g. RefTypeAnnotation) without context.
In general I think, as a customer of the API, its pretty straight forward to write out different libraries depending on the use-case if having a rough understanding of the Meta-Model and the intermediate API, just by looking at the C# implementation of @mristin (good design :)).
Personally I think, good DX is one of the key-factors for good adoption of the library, assuming that the average customer of the API does not want to spend hours or days. That being said, I think it could be nice in the future, to also have some higher-level APIs (maybe language specific) for quickly writing out SDKs or code (e.g. scaffolders.. you name it). This equally applies for the AAS itself, its REST-Documentation etc., as I find it cumbersome to go through the PDFs to gather all the information (like Constraints), given the fact that there are nice libraries out there (like https://docusaurus.io/) with builtin Search from Algolia. Maybe we can also use the aas-core-gen to render some markup documents based on the metamodel which can then be enhanced by the content of the book. I could provide the implementation for that.
So far, looking forward to working further on that.
For the Go-Stuff: Unfortunately, I haven't checked out the latest commits from you @mristin. After doing a rebase some stuff crashed (something in _translate.py from intermediate). Since its already late, I made a fork and pushed my stuff with an old version.
Some docs (actually just thoughts) can be found here: https://github.com/gillistephan/aas-core-codegen/blob/sg/golang-poc/aas_core_codegen/golang/structure.md
The generated code lives here: https://github.com/gillistephan/aas-core-codegen/tree/sg/golang-poc/test_data/test_golang/test_main/v3rc2/expected_output
And the implementation can be found here: https://github.com/gillistephan/aas-core-codegen/tree/sg/golang-poc/aas_core_codegen/golang