SeelabFhdo / lemma

Home of the Language Ecosystem for Modeling Microservice Architecture (LEMMA)
MIT License
33 stars 8 forks source link

OpenAPI Support: adds means to generate models based on openapi files #31

Closed josor001 closed 1 year ago

josor001 commented 3 years ago

To access the functionality a new item is added to the LEMMA menu in the Eclipse IDE. The version is developed and tested with OpenAPI specification v3.0.3. For parsing the json/yaml file content the swagger openapi parser is used. All necessary libs are embedded.

frademacher commented 3 years ago

Fix the commit message:

frademacher commented 3 years ago

After the reviewing the PR and reasoning a bit about it, it would probably make sense to split the commit into several commits along the introduction of the language extractors. This split would facilitate reviewing and decrease the coupling of the changes. More specifically, the commits could be split into the following "topics":

josor001 commented 3 years ago

During testing I encountered three small issues which I should fix before updating the request: (1) Names of interfaces, operations, parameters etc. should be filtered more precisely. E.g. "-" or keywords such as "fields" are currently directly taken from the OpenAPI model but are not allowed in LEMMA. (2) Under certain circumstances duplicates of list-types are generated in the data model (replicate through customer-core of lakeside mutual example). Apparently a check for existing list structures is not working properly, prob. due to some capitalizing of letters when comparing for existing structures) (3) When directly executing the module is a little "chatty" in the system.output. Maybe reduce the noise ;)

josor001 commented 3 years ago

Even before the transformation is started, openapi models should be validated. The used framework probably has a function for that. I should add this to the generate() method which triggers or the UI. Maybe use: https://validator.swagger.io/

josor001 commented 3 years ago

In order to make the transformation more robust it would be nice to define error classes. In case of urgent errors the transformation should terminate without a result. In case of smaller errors, e.g., a datatype can not be parsed, a warning for a later report sould be generated but the generation as a whole should proceed. Should be possible throwing and catching exceptions which are propagated to some kind of central error log.

josor001 commented 3 years ago

Furthermore, I should check if the used parsing framework supports callback functions which would make the whole processing more elegant instead of manually parsing everything.

frademacher commented 3 years ago

Since we're now on Java 11 and Eclipse 2021-03, please rebase on master, and also update the dependencies of the new plugins and other artifacts in files MANIFEST.MF, pom.xml, build.gradle.kts etc. to be compatible with Java 11/Eclipse 2021-03. See the overview at https://fh-dortmund.sciebo.de/s/NBZehLTonzoGF2L for the version updates applied to the other LEMMA plugins/artifacts.