UML to JSON

1,712 views
Skip to first unread message

Ram

unread,
Dec 16, 2014, 6:46:54 AM12/16/14
to sta...@googlegroups.com

First of all I congrats your efforts on making wonderful StrarUML product with next generation UI and Interfaces.

I would like to get output from my model instead of Java code to JSON.

Please let know if there is any possibility to extend this kind of functionality.

Thanks & Regards

Ram



StarUML

unread,
Dec 17, 2014, 1:44:22 AM12/17/14
to sta...@googlegroups.com
Hi Ram,

Do you know the model file saved by StarUML 2 is JSON format? You can parse .mdj file using any JSON parsers.
If you want to get more customized outputs from .mdj file, then please check our open source framework (metadata-json) and a command line tool (mdgen). They are very helpful to generate text-based artifacts from .mdj file.

Thanks,
StarUML Team


2014년 12월 16일 화요일 오후 8시 46분 54초 UTC+9, Ram 님의 말:

Ram

unread,
Dec 17, 2014, 2:34:59 AM12/17/14
to sta...@googlegroups.com, sta...@googlegroups.com
Thanks for your response, 

I would like to use StarUML for model generation with loopback.js (node.js framework).

I don't have clear idea how metadata-json works for me, using diagrams i need to get json based models please refer loopback models.

for example i have two models "Product" and "Users" both are related to each other and also has some properties as listed here...

#product.json

  "name": "project",
  "base": "PersistedModel",
  "idInjection": true,
  "properties": {
    "name": {
      "type": "string"
    },
    "balance": {
      "type": "number"
    }
  },
  "validations": [],
  "relations": {
    "user": {
      "type": "belongsTo",
      "model": "user",
      "foreignKey": "ownerId"
    }
  },
  "acls": [
    
  ],
  "methods": []
}



#user.json

{
  "name": "user",
  "base": "User",
  "idInjection": true,
  "properties": {},
  "validations": [],
  "relations": {
    "projects": {
      "type": "hasMany",
      "model": "project",
      "foreignKey": "ownerId"
    },
    "teams": {
      "type": "hasMany",
      "model": "team",
      "foreignKey": "ownerId"
    }
  },
  "acls": [
    {
      "accessType": "READ",
      "principalType": "ROLE",
      "principalId": "$everyone",
      "permission": "ALLOW"
    }
  ],
  "methods": []
}


I would like to extend StarUML to output like above .json format or at least relationships between two models.

Is there any way we could achieve ?

Regards
Ram.

Reply all
Reply to author
Forward
0 new messages