Skip to content

Codegen

André edited this page Dec 13, 2018 · 2 revisions

REST Api

Model classes for the REST Api can be created with the help of Swagger

{
	"packageName" : "Processes.Proteus.Rest"
}
  • start the vicci-runtime
  • download swagger definition from http://localhost:8082/api/swagger.json or use the link as source in the following commands
  • create either only model code or all including REST client

create only the model

java -Dmodels -jar swagger-codegen-cli.jar generate -i "swagger.json" -l csharp -o modelconfig -c config.json

create all (including the REST client)

java -jar swagger-codegen-cli.jar generate -i "swagger.json" -l csharp -o allconfig -c config.json

NOTE

Swagger will create a lot of code and some code which you will probably not need. Perhaps you have to edit the created files afterwards and remove unused code.

Sofia Model

There is a generator file which lets you generate the model classes in csharp.

  • open account in genmymodel(should be free)
  • create new EMF Project
  • import the sofia.ecore file
  • create new generator
  • import the ecore2csharp.mtl generator code
  • generate files
  • edit manually the errors, which are caused by multiple inheritance (Identifiable, Nameable)
Clone this wiki locally